混淆矩阵为[1064 0 0 0][5 1086 2 0][0 0 481 1][0 0 1 499],计算每类精确率、召回率、F1值、准确率
时间: 2024-01-11 16:05:48 浏览: 77
首先,混淆矩阵可以表示为:
| | 预测为类别1 | 预测为类别2 | 预测为类别3 | 预测为类别4 |
| --- | --- | --- | --- | --- |
| 实际为类别1 | 1064 | 0 | 0 | 0 |
| 实际为类别2 | 5 | 1086 | 2 | 0 |
| 实际为类别3 | 0 | 0 | 481 | 1 |
| 实际为类别4 | 0 | 0 | 1 | 499 |
可以计算出每个类别的精确率、召回率、F1值和准确率。
对于类别1来说:
- 精确率 = TP / (TP + FP) = 1064 / (1064 + 5 + 0 + 0) ≈ 0.9953
- 召回率 = TP / (TP + FN) = 1064 / (1064 + 0 + 0 + 0) = 1
- F1值 = 2 * 精确率 * 召回率 / (精确率 + 召回率) ≈ 0.9976
- 准确率 = (TP + TN) / (TP + TN + FP + FN) = (1064 + 1086 + 481 + 499) / (1064 + 0 + 0 + 5 + 1086 + 2 + 0 + 0 + 481 + 1 + 0 + 499) ≈ 0.9971
对于类别2来说:
- 精确率 = TP / (TP + FP) = 1086 / (5 + 1086 + 2 + 0) ≈ 0.9945
- 召回率 = TP / (TP + FN) = 1086 / (0 + 1086 + 0 + 0) = 1
- F1值 = 2 * 精确率 * 召回率 / (精确率 + 召回率) ≈ 0.9972
- 准确率 = (TP + TN) / (TP + TN + FP + FN) = (1064 + 1086 + 481 + 499) / (1064 + 0 + 0 + 5 + 1086 + 2 + 0 + 0 + 481 + 1 + 0 + 499) ≈ 0.9971
对于类别3来说:
- 精确率 = TP / (TP + FP) = 481 / (0 + 0 + 481 + 1) ≈ 0.9979
- 召回率 = TP / (TP + FN) = 481 / (0 + 0 + 0 + 1) = 0.998
- F1值 = 2 * 精确率 * 召回率 / (精确率 + 召回率) ≈ 0.9980
- 准确率 = (TP + TN) / (TP + TN + FP + FN) = (1064 + 1086 + 481 + 499) / (1064 + 0 + 0 + 5 + 1086 + 2 + 0 + 0 + 481 + 1 + 0 + 499) ≈ 0.9971
对于类别4来说:
- 精确率 = TP / (TP + FP) = 499 / (0 + 0 + 1 + 499) ≈ 0.998
- 召回率 = TP / (TP + FN) = 499 / (0 + 0 + 0 + 1) = 0.999
- F1值 = 2 * 精确率 * 召回率 / (精确率 + 召回率) ≈ 0.9985
- 准确率 = (TP + TN) / (TP + TN + FP + FN) = (1064 + 1086 + 481 + 499) / (1064 + 0 + 0 + 5 + 1086 + 2 + 0 + 0 + 481 + 1 + 0 + 499) ≈ 0.9971
因此,每个类别的精确率、召回率、F1值和准确率分别为:
| | 精确率 | 召回率 | F1值 | 准确率 |
| --- | --- | --- | --- | --- |
| 类别1 | ≈0.9953 | 1 | ≈0.9976 | ≈0.9971 |
| 类别2 | ≈0.9945 | 1 | ≈0.9972 | ≈0.9971 |
| 类别3 | ≈0.9979 | 0.998 | ≈0.9980 | ≈0.9971 |
| 类别4 | ≈0.998 | 0.999 | ≈0.9985 | ≈0.9971 |
阅读全文