When evaluating the detection effect of machine learning models or binary classification problem models, several evaluation indicators are often involved, including accuracy, accuracy, recall and F1 values. People often become easily confused by these words and it is difficult to

often involves several evaluation indicators in evaluating the detection effect of machine learning models or binary classification problem models, including accuracy, accuracy, recall and F1 values. People often easily confuse these words and find it difficult to accurately grasp their meanings. The following will explain these words to facilitate everyone to formulate appropriate model evaluation indicators.

Background knowledge:

Before understanding the four indicators, use different letters to represent different results. T (True), F (false), P (Positive), N (Negative), and mark the judgment result T/F based on the real results and judgment results. Use the following table to facilitate your understanding.

Confusion matrix

Real result

T

F

F

Judgement Results

T

TP

FP

F

FN

TN

TP: It means that the real result is true, the judgment result is also true, judged correctly

FP: It means that the real result is false, but it was misjudged as true, judgment error

FN: The real result is true, but it is misjudged as false, judgment error

TN: It means that the real result is false, and the judgment result is also false, judgment is correct

1, accuracy rate

accuracy rate (Accuracy), that is, the judgment result is correct as a percentage of the total sample, the expression is as follows:

accuracy = (TP+TN)/ (TP+TN+FP+FN),

From this expression, it can be seen that the molecules include TP and TN, that is, they contain the detection of the same as the real result, but there are two cases where the real positive sample and the real negative sample. If the sample number of the two is large, such as the qualified product is about 95% and the defective product is 5%, if both are predicted to be qualified, then the accuracy rate is as high as 95%. Such accuracy cannot reflect the real effect of the model well, so the following indicators are needed.

2, accuracy rate

Precision rate (Precision), refers to the probability that the true result is true, the probability that all samples judged that the result is true, the expression is as follows:

Precision rate = TP / (TP+FP)

Overall people will be more likely to confuse the concepts of accuracy and accuracy. The accuracy is the accuracy of judging positive samples, while the accuracy is the accuracy of judging overall samples. The difference can be clearly seen from the expression.

3. Recall rate

recall rate (Recall), refers to the proportion of the true samples to all the samples judged as true.

expression is recall = TP/(TP+FP)

For example: There are 10 eggs in the sample, 4 of which are bad eggs. The design model was used to detect the bad eggs, and finally found 5, but only 3 of them were bad eggs. Then the accuracy of the model is 3/5=60%, that is, out of 5 eggs found, only 3 were found. The recall rate of

model is 3/4=75%. What you need to find are 4 bad eggs, but only 3 are found.

This is an example of recall and precision, which can help you understand the concept.

4, F1 value

F1 value, that is, F1-Score. The accuracy rate mentioned above is also called the accuracy rate, and the recall rate is also called the complete rate. In actual calculations, accuracy and recall are often difficult to have the best of both worlds, so find the balance point between the two through the F1 value.

F1 value expression is F1-Score=2*precision rate*recall rate/(accuracy rate+recall rate)

I hope this introduction will be helpful to everyone's study and work. Welcome to pay more attention.