机器学习——准确率、精度、召回率和F1分数(Machine Learning - Accuracy, Precision, Recall, F1-Score)

时间:2022-12-07 11:20:07

Evaluation of Machine Learning Algorithm
Once you have done a machine learning model for classification problem, we want to know the accuracy of prediction of the model. We can use accuracy, precision, recall and f1-score to show how good the model is.

Basic Terms

Positive(P): The ground truth is positive (e.g. it is an iPhone)
Negative(N): The ground truth is negative (e.g. it is not an iPhone)
True Positive(TP): The prediction is positive; The ground truth is positive.
False Positive(FP): The prediction is positive; The ground truth is negative.
True Negative(TN): The prediction is negative; The ground truth is negative.
False Negative(FN): The prediction is negative; The ground truth is positive.

Error
Proportion of all predictions that are incorrect. Error is a measurement of how bad a model is.
机器学习——准确率、精度、召回率和F1分数(Machine Learning - Accuracy, Precision, Recall, F1-Score)

Accuracy
Proportion of all predictions that are correct. Accuracy is a measurement of how good a model is.
机器学习——准确率、精度、召回率和F1分数(Machine Learning - Accuracy, Precision, Recall, F1-Score)

Precision
Proportion of all positive predictions that are correct. Precision is a measurement of how many positive predictions were actual positive observations.
机器学习——准确率、精度、召回率和F1分数(Machine Learning - Accuracy, Precision, Recall, F1-Score)

Recall
Proportion of all real positive observations that are correct. Precision is a measure of how many actual positive observations were predicted correctly.
机器学习——准确率、精度、召回率和F1分数(Machine Learning - Accuracy, Precision, Recall, F1-Score)

F1-Score
The harmonic mean of precision and recall. F1 score is an ‘average’ of both precision and recall. We use the harmonic mean because it is the appropriate way to average ratios (while arthmetric mean is appropriate when it conceptually makes sense to add things up).
机器学习——准确率、精度、召回率和F1分数(Machine Learning - Accuracy, Precision, Recall, F1-Score)

示例
机器学习——准确率、精度、召回率和F1分数(Machine Learning - Accuracy, Precision, Recall, F1-Score)
Error=4/8=50%
Accuracy=4/8=50%
Precision=1/4=25%
Recall=1/2=50%
F1-score=33.3%

最后再说两句(PS)
We can use those measurements to compare performance of multiple machine learning algorithms.

More resources 1, 2, 3, 4.

Welcome questions always and forever.