【发布时间】:2023-01-12 18:12:43
【问题描述】:
我已经训练了一个基于 transformer 的分类器,它有 2 个类 (0,1),在一个完美平衡的数据集上达到了 91% 的准确率。在调整了验证数据的阈值后,我在验证数据上打印出了混淆矩阵,这些是结果,但它们是完美平衡的。你觉得有道理吗?
09:29:30 root INFO:*** EVALUATION ON VALIDATION DATA ***
09:29:30 root INFO:AUC: 0.9708
09:29:30 root INFO:Tuned Threshold: 0.3104
09:29:31 root INFO:Matthews Correlation Coefficient computed after applying the tuned/selected threshold : 0.8230210619188743
09:29:31 root INFO:Accuracy: 91.15%
09:29:32 root INFO:--Classification report for VAL DATA--
09:29:32 root INFO: precision recall f1-score support
0 0.91 0.91 0.91 88406
1 0.91 0.91 0.91 88406
accuracy 0.91 176812
macro avg 0.91 0.91 0.91 176812
weighted avg 0.91 0.91 0.91 176812
pred:0 pred:1
true:0 80583 7823
true:1 7823 80583
谢谢你的建议。
更新:
使用相同阈值的测试集上的混淆矩阵:
pred:0 pred:1
true:0 81714 9968
true:1 9612 82070
【问题讨论】:
-
您是使用内置的
sklearn.metrics.confusion_matrix还是尝试自己实现? -
内置的
-
真奇怪!验证集包含多少样本? 1和0分别是多少?
-
您是否检查过混淆矩阵中是否存在任何不一致?总结例如
标签: nlp classification bert-language-model confusion-matrix transformer-model