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.
Accuracy
Proportion of all predictions that are correct. Accuracy is a measurement of how good a model is.
Precision
Proportion of all positive predictions that are correct. Precision is a measurement of how many positive predictions were actual positive observations.
Recall
Proportion of all real positive observations that are correct. Precision is a measure of how many actual positive observations were predicted correctly.
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).
示例
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.
Welcome questions always and forever.