def score_func_to_gridsearch(estimator, X_test=None, y_test=None):
""" Function to be given as a scorer function to Grid Search Method.
It is going to transform the matrix os predicts generated by 'all' option
to an final accuracy score. Use a high value to CV
"""
if not hasattr(estimator, 'fitnesses_'):
raise ValueError("Fit")
obj1=[]
obj2=[]
for i in range(len(estimator.best_pareto_front_)):
obj1.append(estimator.best_pareto_front_[i].fitness.values[0])
obj2.append(estimator.best_pareto_front_[i].fitness.values[1])
obj1.append(obj1[0])
obj2.append(1)
return auc(obj2, obj1, reorder=True)
评论列表
文章目录