Closed astha234 closed 6 years ago
I guess it's because MLPRegressor is for doing regression and not classification. Does it work if you try to use GridSearchCV instead of EvolutionaryAlgorithmSearchCV?
yes. I got GridSearchCV to work:
You can't use the "scoring" parameter with 'accuracy' for MLPRegressor, you should leave it as None in the same way you did with GridSearchCV
Following is my code: from evolutionary_search import EvolutionaryAlgorithmSearchCV from sklearn.model_selection import StratifiedKFold
paramgrid = {"activation": ["identity", "logistic", "tanh", "relu"], "solver" : ["lbfgs", "sgd", "adam"], "hidden_layer_sizes" : [1,2,3,4], "max_iter" : [100,150]}
cv = EvolutionaryAlgorithmSearchCV(estimator=MLPRegressor(), params=paramgrid, scoring="accuracy", cv=StratifiedKFold(n_splits=2), verbose=1, population_size=50, gene_mutation_prob=0.10, gene_crossover_prob=0.5, tournament_size=3, generations_number=5, n_jobs=4) cv.fit(x,y)
The Error I get:
ValueErrorTraceback (most recent call last)