我有一個名爲X
的數據框和一組名爲Y
的目標值。TPOT:使用TPOTRegressor時酸洗錯誤
對於大多數我的模型,我做這樣的事情(只是一個例子):
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(代= 5,population_size = 20,CV = 5, random_state = 42,冗長度= 2),而不是使用使用regression.then clf.score(X_test,y_test) –
@ Mr_U4913我應該使用TPOTRegressor,我相信,因爲它是一個迴歸問題 – bclayman