Open jCrompton opened 6 years ago
basically I want to change creator.create("FitnessMax", base.Fitness, weights=(1.0,)) to creator.create("FitnessMax", base.Fitness, weights=(-1.0,))
When creating the cv, you can wrap the scoring
function parameter. For example:
from functools import wraps
from sklearn import accuracy_score
from evolutionary_search import EvolutionaryAlgorithmSearchCV
...
def wrap_score_func(score_func):
@wraps(score_func)
def wrapped(*args, **kwargs):
return -score_func(*args, **kwargs)
return wrapped
...
cv = EvolutionaryAlgorithmSearchCV(estimator=SVC(),
params=paramgrid,
scoring=wrap_score_func(accuracy_score),
...)
Ideally, this should just be a parameter during cv initialization.
Created PR #51
Line 305 in cv.py, is there anyway we can change the weights tuple to minimize a loss function rather than always maximize ?