> For the complete documentation index, see [llms.txt](https://windmising.gitbook.io/liu-yu-bo-play-with-machine-learning/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://windmising.gitbook.io/liu-yu-bo-play-with-machine-learning/src/chapter10/10-1.md).

# 第十章：评价分类结果

假设有一个算法，其预测某种癌症的准确率为99.9%。这个算法好吗？

999%的准确率看上去很高，但是如果这种癌症本身的发病率只有0.1%，即使不训练模型而直接预测所有人都是健康人，这样的预测的准确率也能达到99.9%。\
更极端的情况，如果这种癌症本身的发病率只有0.01%，这算法预测的准确率还不如直接预测所有人都健康。\
对于极度偏斜的数据（skewed data），用准确率评价分类算法好坏有局限性。\
解决方法：混淆矩阵

## 工具：混淆矩阵，以二分类为例

0 - Negative - 阴性, 1 - Positive - 阳性\
1是我们关注的部分。

| 预测值：0 | 预测值：1                                      |                                            |
| ----- | ------------------------------------------ | ------------------------------------------ |
| 真实值：0 | <p>预测Negative正确<br><strong>TN</strong></p> | <p>预测Positive错误<br><strong>FP</strong></p> |
| 真实值：1 | <p>预测Negative错误<br><strong>FN</strong></p> | <p>预测Positive正确<br><strong>TP</strong></p> |
