OhMyCalc

Confusion Matrix Calculator

Calculate accuracy, precision, recall, F1, specificity, and MCC from a confusion matrix. Enter TP, TN, FP, FN to get all key classification metrics.

How to Use the Confusion Matrix Calculator

  1. Enter True Positives (TP).
  2. Enter True Negatives (TN).
  3. Enter False Positives (FP).
  4. Enter False Negatives (FN).
  5. Click Calculate to see all metrics.

使用场景

公式

Accuracy = (TP+TN)/(TP+TN+FP+FN). Precision = TP/(TP+FP). Recall = TP/(TP+FN). F1 = 2PR/(P+R). Specificity = TN/(TN+FP). MCC = (TP×TN−FP×FN)/√((TP+FP)(TP+FN)(TN+FP)(TN+FN)).

常见问题

What is a confusion matrix?
A confusion matrix shows the counts of true positives, true negatives, false positives, and false negatives for a classifier.
What is MCC?
Matthews Correlation Coefficient (MCC) is a balanced measure even for imbalanced classes, ranging from -1 to +1.
What is specificity?
Specificity (true negative rate) = TN / (TN + FP), measuring how well the model identifies negatives.