Confusion Matrix Calculator

Evaluate a classifier from its confusion matrix: accuracy, precision, recall, F1 score and Matthews correlation.

Your details

Your data stays in your browser

Result

Enter the four cells, then press “Calculate”.

F1 level

Your result will be marked here once calculated.

  1. WeakUnder 0.5
  2. Fair0.5–0.7
  3. Good0.7–0.85
  4. Excellent0.85 or more

A rough guide; what’s acceptable depends on the field and the problem.

Analysis and suggestions

Once calculated, this shows what your result means and suggestions based on your numbers.

Behind the result

Evaluate a classifier from its confusion matrix: accuracy, precision, recall, F1 score and Matthews correlation.

Example · Precision = TP ÷ (TP + FP) | Recall = TP ÷ (TP + FN) | F1 = 2TP ÷ (2TP + FP + FN) | MCC = (TP·TN − FP·FN) ÷ √((TP+FP)(TP+FN)(TN+FP)(TN+FN))

F1 = 2 × 80 ÷ (2 × 80 + 20 + 10) = 0.8421

How it is calculated

Comprehensive Calculator Guide

This calculator scores a classifier from its confusion matrix: F1, accuracy, precision, recall, specificity and the Matthews coefficient. A spam filter with 80, 20, 10, 890 has F1 = 0.842 and 97% accuracy.

Beyond accuracy

Precision asks how many flagged items were right, recall how many real positives were found; F1 balances them. On imbalanced data a do-nothing model can score high accuracy, so use F1 and MCC.

How to Use

  1. Enter TP and FP.
  2. Enter FN and TN.
  3. Press “Calculate” to see the metrics.

Formula Used

F1 = 2TP/(2TP + FP + FN) | MCC = (TP·TN − FP·FN)/√((TP+FP)(TP+FN)(TN+FP)(TN+FN))

Practical Examples

Example 1
80, 20, 10, 890: F1 0.842, MCC 0.827.
Example 2
Always negative: accuracy 95%, F1 0.

Important Tips

  • Check class balance first.
  • Tune the threshold to the cost of errors.
  • Use MCC for imbalanced classes.

Common Mistakes to Avoid

  • Accuracy alone.
  • Mixing up precision and recall.
  • Testing on training data.

Frequently Asked Questions

Precision vs recall?
Right among flagged vs found among real.
When F1?
Rare positive class.
Why MCC?
It uses all four cells.

Read Also

Results are estimates for educational purposes and may vary depending on your situation and data sources.