## 混淆矩阵

In the field of machine learning and specifically the problem of statistical classification, a confusion matrix, also known as an error matrix,[4] is a specific table layout that allows visualization of the performance of an algorithm, typically a supervised learning one (in unsupervised learning it is usually called a matching matrix). Each column of the matrix represents the instances in a predicted class while each row represents the instances in an actual class (or vice versa).

## PR 曲线与 ROC 的定义

$$P = {TP \over TP + FP}$$

$$R = {TP \over TP + FN}$$

$$TPR = {TP \over TP + FN}$$

$$FPR = {FP \over TN + FP}$$

## PR 曲线与 ROC 的关系

P-R 曲线与 ROC 曲线都是用来评估模型好坏的。而且，对于一个给定的包含正负样本的数据集，ROC曲线和P-R曲线存在一一对应的关系，也就是说。如果查全率不等于0，二者对应了完全一致的混淆矩阵。我们可以将ROC曲线转化为PR曲线，反之亦然。