当前位置:网站首页>Evaluation index of machine learning (II) -- classification evaluation index
Evaluation index of machine learning (II) -- classification evaluation index
2022-07-27 18:03:00 【helpburn】
See :https://blog.csdn.net/itlilyer/article/details/117880207
Now let's introduce the commonly used evaluation indicators in classification problems .
Before introducing the evaluation indicators, you should first understand " Confusion matrix "." Confusion matrix " Personal understanding is an explanatory matrix that analyzes the different situations of a classification model in predicting the results of an input data .
From the table, we can see that there are four combinations of real values and predicted results :
real (True Positive): Put the tag, that is, the true value True The prediction is Positive, such as , Put a picture of a puppy , The label is dog , The prediction result is also for dogs .
True negative (True Negative): Put the tag, that is, the true value False The prediction is Negative, such as , Put a picture that is not a puppy , Label as other , The prediction results are also for others .
False positive (False Positive): Put the tag, that is, the true value False The prediction is Positive, such as , Put a picture of kitten , Label as cat , But the prediction is dog .
False negative (False Negative): Put the tag, that is, the true value True The prediction is Negative, such as , Put a picture of a puppy , The label is dog , The prediction result is not a dog .
The real rate (True Positive Rate,TPR): Also known as sensitivity , Positive samples predicted to be positive / The total number of actual positive samples ——TPR = T P T P + F N \frac {TP} {TP+FN} TP+FNTP
What a negative rate (True Negative Rate,TNR): It's also called specificity , Negative samples predicted to be negative / Actual total number of negative samples ——TNR = T N T N + F P \frac {TN} {TN+FP} TN+FPTN
False positive rate (False Positive Rate,FPR): Negative samples predicted to be positive / Actual total number of negative samples ——FPR = F P F P + T N \frac {FP} {FP+TN} FP+TNFP
False negative rate (False Negative Rate,FNR): Positive samples predicted to be negative / The total number of actual positive samples ——FNR = F N T P + F N \frac {FN} {TP+FN} TP+FNFN
1. Accuracy rate
Accuracy rate (Accuracy): The number of samples with correct classification / The total number of samples , That is, the prediction result of positive samples is positive , The sum of negative sample prediction results divided by the total number .
ACC = T P + T N T P + T N + F P + F N \frac {TP + TN} {TP + TN + FP + FN} TP+TN+FP+FNTP+TN
2. Average accuracy
Average accuracy (Average per-class Accuracy): The average of the preparation rates of all categories , This refers to the average value of predicting positive samples as positive and negative samples as negative .
AVE_ACC = T P T P + F N + T N T N + F P 2 \frac {\frac {TP} {TP + FN} + \frac {TN} {TN + FP}} {2} 2TP+FNTP+TN+FPTN
3. Error rate
Error rate : Number of samples with wrong classification / The total number of samples .
ERROR = F P + F N T P + T N + F P + F N \frac {FP + FN} {TP + TN + FP + FN} TP+TN+FP+FNFP+FN
4. Accuracy
Accuracy (Precision): It's also called precision rate , See how many of the prediction results are correct . For example, prediction 10 Pictures are dogs , But what is really for dogs is 8 individual , Others are cats and pigs , Then the accuracy is 0.8.
P = T P T P + F P \frac {TP} {TP + FP} TP+FPTP
5. Recall rate
Recall rate (Recall): It's also called recall , It refers to the proportion of positive samples with correct prediction in all positive samples . Let's say there are 15 Picture of dog , among 12 Zhang predicted a dog , Other predictions are for other animals , Then the recall rate is 0.8.
Recall = T P T P + F N \frac {TP} {TP + FN} TP+FNTP
6.F1
F-Score( Also called F-Measure): Because under different circumstances, we pay different attention to precision and recall , Some need to reduce prediction errors as much as possible , Some require a higher recall rate .F1 Is the harmonic mean Fβ A special case , When β take 1 It degenerates into F1.
Fβ = ( 1 + β 2 ) ∗ P ∗ R ( β 2 ∗ P ) + R \frac {(1 + \beta^2) * P * R} {( β^2 * P) + R} (β2∗P)+R(1+β2)∗P∗R ; When β=1 when , F1 = 2 ∗ P ∗ R P + R \frac {2 * P * R} {P + R} P+R2∗P∗R
7. ROC and AUC
ROC(Receiver Operating Characteristic), It is often used to evaluate the merits of a binary classifier . A threshold is usually set in logistic regression , If it exceeds the threshold, it is predicted to be positive , Less than the threshold is negative . If the value is reduced, the number of predicted positive classes will increase , At the same time, some samples that are originally negative classes will be identified as positive classes .ROC This phenomenon can be expressed intuitively . We have introduced the real rate above (TPR, True Positive Rate) And the false positive rate (FPR, False Positive Rate),ROC The curve is based on TPR by y Axis ,FPR by x The axis is a curve obtained according to the classification results . If the curve is relatively smooth, there is generally no fitting problem .
We mainly focus on four points and a line in the graph .
The first point **(0, 0): namely TPR and FPR All are 0, In other words, the classifier predicts all samples as negative classes regardless of positive or negative .
Second points (0, 1): namely TPR = 1,FPR = 0, That is to say, all samples are classified correctly , Positive samples are predicted to be positive , Negative samples are predicted to be negative .
The third point (1, 0): namely TPR = 0,FPR = 1, That is to say, all samples are classified incorrectly , The positive sample is predicted to be negative , Negative samples are predicted to be positive .
Fourth point (1, 1)**: namely TPR and FPR All are 1, In other words, the classifier predicts all samples as positive classes regardless of positive or negative .
Through the significance of these points, we can see ROC The closer the curve is to the top left , The better the performance of the classifier .
AUC(Area Under Curve): yes ROC The area under the curve , The larger the area, the better the classifier . Obviously, the area will not be about 1.
ROC and AUC There is a characteristic : No matter what the number distribution of positive and negative samples of the tester is ,ROC The curve will not change . In view of the uneven distribution of sample data in the actual data set , Positive samples will be much more or less than negative samples .
8. PR curve
PR The abscissa of the curve is Recall, The ordinate is Precision. One PR The curve should correspond to a threshold ( Statistical probability ). By selecting the appropriate threshold ( such as 0.5) Divide the samples reasonably , The probability is greater than 0.5 The sample of is a positive example , Less than 0.5 The sample of is negative , After the completion of sample classification, calculate the corresponding accuracy rate and recall rate , Finally, we will get the corresponding relationship , As shown in the figure below .
After many learners learn the data , If one of the learners PR curve A Completely enclose another learner B Of PR curve , It can be asserted that A Better performance than B. however A and B Cross occurs , How to judge the performance ? We can compare according to the area below the curve , But the more commonly used is the balance point F1. Balance point (BEP) yes P=R The value of time ( The slope is 1),F1 The bigger the value is. , We can think that the performance of the learner is better .F1 We have already introduced the calculation formula of
边栏推荐
- Oracle 11g数据库安装教程
- Database hyperphone (III)
- Anaconda uninstall again
- Cow! His secret is to reproduce the paper in 2 hours——
- Switch and router technology-02-working principle of Ethernet switch
- kubernetes 1.24高可用集群二进制部署
- Windows and network foundation-15-local security policy
- Can oracle-linux-7.9 support oracle-19c ACFs file system?
- How to develop an online Excel spreadsheet system (Part 1)
- Compilation and testing of raspberry pie driver code
猜你喜欢

写好技术原创文章的一点建议

Fast parsing combined with Huatu document encryption software

An end-to-end file upload program based on form, including client and server

What should we pay attention to when choosing the LED display screen of the stadium
知物由学 | SO加固如何提升Android应用的安全性?

【Codeforces】 A. Computer Game

TCP的连接状态标识 (SYN, FIN, ACK, PSH, RST, URG)

【单片机】2.1 AT89S52单片机的硬件组成

微信小程序 实现位置地图显示,引入map地图,不含导航

Switch and router technology-03-basic configuration of switch
随机推荐
帮扶、提振、担当,第六届土巴兔718全民家装节的新价值和意义
[introduction to database system (Wang Shan)] Chapter 4 - Database Security
Could not obtain transaction-synchronized Session for current thread
Database hyperphone (III)
快解析结合海典医药
#yyds干货盘点# 面试必刷TOP101:链表内指定区间反转
numpy数组矩阵操作
Knowing things by learning | app slimming down, the way of safety reinforcement under the new generation AAB framework
【obs】x264_encoder_encode 编码输出pts dts和 framesize
PostgreSQL 14 支持winserver2022吗?
Cow! His secret is to reproduce the paper in 2 hours——
Oracle 11g database installation tutorial
如何开发一款在线Excel表格系统(上)
Activate genuine win7 ultimate system with slmgr command
#夏日挑战赛#【FFH】实时聊天室之WebSocket实战
How to learn C language? This article gives you the complete answer
数据库超话(四)
[introduction to database system (Wang Shan)] Chapter 1 - Introduction
数据库超话(一)
Likeshop takeout ordering system "100% open source without encryption"