【发布时间】:2021-07-12 19:13:18
【问题描述】:
我正在尝试使用 GridSearchCV 在二进制分类中对一些机器学习模型进行分类。我想根据分数、最佳参数和 f2 分数对模型进行分类。
对于分数和最佳参数我使用了代码
scores = []
for model_name, mp in model_params.items():
clf = GridSearchCV(mp['model'], mp['params'], cv=5, return_train_score=False)
clf.fit(X_test, y_test)
scores.append({
'model': model_name,
'best_score': clf.best_score_,
'best_params': clf.best_params_
})
df = pd.DataFrame(scores,columns=['model','best_score','best_params'])
它为所有模型提供了best_score 和best_params,但我无法找到所有模型的 f2 分数。代码应该是什么?
【问题讨论】:
标签: python machine-learning scikit-learn