我正在尝试分析我的结果,所以我在sklearn上使用F1得分指标和分类报告。无论采用何种平均方法,显示的结果都完全不同。它们根本不匹配。以下是我的验证数据示例:
F1得分为0.7666666666666667
但分类报告的结果如下:
F1得分为0.7666666666666667
但分类报告的结果如下:
report precision recall f1-score support
0 0.16 0.57 0.25 7
1 0.40 0.09 0.14 23
accuracy 0.20 30
macro avg precision: 0.28, recall:0.33, f1score:0.20 support:30
weighted avg precision:0.34 recall:0.20 f1score:0.17 support:30
任何帮助都将不胜感激。 谢谢!
我的代码是: ` print('F1得分 {}'.format(sklearn.metrics.f1_score(test_label, np.round(y_pred), average='micro'))´
对于分类报告,它是:
` print('F1得分 {}'.format(sklearn.metrics.classification_report(test_label, np.round(y_pred), target_names=labels))´
标签只是一个包含我的类标签的列表。