I have a DataFrame called X
and a set of target values called Y
.
For most of my models, I do something like this (just an example):
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])
I'm trying to use TPOT in a similar way, as follows:
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 starts up but then gives me a pickling error as follows:
PicklingError: Can't pickle <type 'instancemethod'>: it's not found as __builtin__.instancemethod
Any idea why this is happening / how to get TPOT to play nicely?
Thanks!