Model evaluation
ML Metrics Calculator
Enter the four cells of a binary confusion matrix to calculate precision, recall, F1, and accuracy.
0%
Precision
0%
Recall
0%
F1 score
0%
Accuracy
The four formulas
precision = TP / (TP + FP)\nrecall = TP / (TP + FN)\nF1 = 2 × precision × recall / (precision + recall)\naccuracy = (TP + TN) / (TP + FP + FN + TN)
Why accuracy can mislead
Accuracy counts every correct prediction, including true negatives. In an imbalanced classification problem, a model can obtain high accuracy while missing most positive cases. Precision and recall expose different failure modes, and F1 compresses the two into one harmonic-mean score.
Choosing a metric
Use precision when false positives are costly, recall when false negatives are costly, and F1 when you need a single balance between the two. In serious model evaluation, also inspect the confusion matrix itself and the class distribution rather than reporting one metric alone.