Closed hyperh closed 8 years ago
I think you should use it like this:
from sklearn.model_selection import TimeSeriesSplit
grid = EvolutionaryAlgorithmSearchCV(
estimator=pipe,
params=param_grid,
scoring=scoring,
cv=list(TimeSeriesSplit(n_splits=10).split(XTrain)),
verbose=1,
population_size=50,
gene_mutation_prob=0.10,
gene_crossover_prob=0.5,
tournament_size=3,
generations_number=5,
n_jobs=4
)
grid.fit(XTrain, yTrain)
I'm not sure how GridSearchCV manages to use it some other way, but this way works for me.
Thanks, that seems to have worked!
sklearn-deap
doesn't seem to like it when I useTimeSeriesSplit
even thoughTimeSeriesSplit
should work like all other cross validation functions insklearn
. I've been usingTimeSeriesSplit
withPipeline
andGridSearchCV
fine; I just replaced theGridSearchCV
withEvolutionaryAlgorithmSearchCV
.