# 模型评价指标

## 1.精度、召回率

记：

* TP(True Positive)：正样本被判定为正样本的数量
* FN(False Negative)：正样本被判定为负样本的数量
* TN(True Negative)：负样本被判定为负样本的数量
* FP(False Positive)：负样本被判定为正样本的数量

则：

* 精度P=TP/(TP+FP)，被判定为正样本中，判断对的比例
* R=TP/(TP+FN)，正样本中，有多少被判断为正（判断正确）的比例
* 极端思考：`分类器全部判断为正样本，则R=1，但是P就可能很低`
* F1=2PR/(P+R)

## 2.ROC曲线

“受试者工作特征”（Receiver Operating Characteristic）

**定义：**

真阳率：TPR=TP/(TP+FN)，正样本被分为正样本的比例

假阳率：FPR=FP/(FP+TN)，负样本被分为正样本的比例

**得到ROC曲线：**

调节分类器的灵敏度阀值$$\xi$$，sgn(f(x)) -> sgn(f(x)+ $$\xi$$)，阀值增大判为正的会增大，真阳率：TPR会提高；负样本判定为正的数量增加，假阳率：FPR也会上升。调整$$\xi$$得到一对点，不同$$\xi$$的点连起来得到ROC曲线

**意义：**

ROC曲线越陡峭、越高、算法性能越好；

## AUC

ROC曲线下的面积就是AUC（Area Under the Curve）

AUC用于衡量“二分类问题”机器学算法性能（泛化能力）。

## 3.混淆矩阵

主要用于多分类，如果都分类正确，则矩阵是对角矩阵，因此对角线上值越大，分类性能越好

## 4.交叉验证

分成k分轮流训练，测试


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://im-qianuxn.gitbook.io/pytorch/ji-suan-ji/ml/wen-da/ping-jia-zhi-biao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
