【发布时间】:2017-12-02 11:00:57
【问题描述】:
我有一个名为 X 的 DataFrame 和一组名为 Y 的目标值。
对于我的大多数模型,我会做这样的事情(只是一个例子):
from sklearn.linear_model import LassoCV
clf = LassoCV()
score = cross_val_score(estimator = clf, X = X, y = Y, cv = KFold(n_splits = 3, random_state = 100), n_jobs = -1, \
scoring = "neg_mean_squared_error")
np.mean([np.sqrt(-x) for x in score])
我正在尝试以类似的方式使用TPOT,如下:
from tpot import TPOTRegressor
tpot = TPOTRegressor(generations=20, population_size=100, verbosity=2)
score = cross_val_score(estimator = tpot, X = X, y = Y, cv = KFold(n_splits = 3, random_state = 100), n_jobs = -1, \
scoring = "neg_mean_squared_error")
np.mean([np.sqrt(-x) for x in score])
TPOT 启动但随后出现如下酸洗错误:
PicklingError: Can't pickle <type 'instancemethod'>: it's not found as __builtin__.instancemethod
知道为什么会发生这种情况/如何让 TPOT 发挥出色?
谢谢!
【问题讨论】:
-
clf =TPOTClassifier(generations=5, population_size=20, cv=5, random_state=42, verbosity=2) 怎么样而不是使用回归。然后使用 clf.score(X_test, y_test)
-
@Mr_U4913 我相信我应该使用 TPOTRegressor,因为这是一个回归问题
标签: python pandas machine-learning scikit-learn tpot