📊 Confusion Matrix Calculator
Plug in the four cells of a binary classifier’s confusion matrix and get accuracy, precision, recall, specificity, and F1 score right away.
What a confusion matrix measures
A confusion matrix summarizes how well a binary classification model performs by counting four outcomes: true positives (correctly predicted positive), false positives (incorrectly predicted positive), false negatives (incorrectly predicted negative), and true negatives (correctly predicted negative). From these four counts, several standard performance metrics can be derived.
The formulas used
Accuracy = (TP + TN) / Total. Precision = TP / (TP + FP), measuring how many predicted positives were actually correct. Recall (also called sensitivity) = TP / (TP + FN), measuring how many actual positives were caught. Specificity = TN / (TN + FP), measuring how many actual negatives were correctly identified. F1 score = 2 × (Precision × Recall) / (Precision + Recall), the harmonic mean of precision and recall.
- High accuracy can be misleading on imbalanced datasets; precision, recall, and F1 often tell a more complete story.
- Choose the metric that matches your goal: recall matters more when missing positives is costly, precision matters more when false alarms are costly.
This calculator is for general educational and model-evaluation purposes.