rsteca / sklearn-deap

Use evolutionary algorithms instead of gridsearch in scikit-learn
MIT License
770 stars 130 forks source link

best_score_ and best_params_ never get updated when error score is negative #12

Closed zickyzazang closed 8 years ago

zickyzazang commented 8 years ago

Some Sklearn scoring functions return negative error scores (e.g. mean absolute error) to stick to the "bigger is better" paradigm. However, with this error score the following code block never is evaluated True

if current_best_score_ > self.best_score_: self.best_score_ = current_best_score_ self.best_params_ = current_best_params_

and the best_score, and more importantly the best_params stay -1 and None respectively.

Setting self.bestscore with -inf or with a much smaller value would sort of solve the issue. Setting best_score with current_best_score in the first generation would be a better solution imo

rsteca commented 8 years ago

Solved in #13