def _get_best_params(obj):
# if obj is a ModelAssessment, then get the first GridSearch
if isinstance(obj, ModelAssessment):
obj = pd.DataFrame(obj.cv_results_).sort_values(
'test_score', ascending=False).iloc[0].estimator
elif not isinstance(obj, GridSearchCV):
raise NotImplementedError("This can only work with a ModelAssessment "
"or GridSearchCV object. You passed "
"a %s object" % obj.__class__.__name__)
return obj.best_params_
评论列表
文章目录