我基于roc优化超参数,但我也想报告模型的准确性。我可以使用.best_score_属性获取roc。有没有办法获得准确性?
hyperparams = {'C': [0.0001, 0.001, 0.01, 0.5, 1, 10, 100, 1000], 'class_weight': [None, 'balanced'],
'tol': [1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7], 'penalty': ['l1', 'l2']}
kfolds = StratifiedKFold(7)
self.model_ = GridSearchCV(LogisticRegression(), hyperparams,
scoring='roc_auc',
cv=kfolds.split(self.all_sets_X, self.all_sets_y))
self.model_.fit(self.all_sets_X, self.all_sets_y)
print({'roc_auc': self.model_.best_score_})
print({'best_params': self.model_.best_params_})