Confusion Matrix Calculator

Enter your model's True Positives (TP), False Positives (FP), False Negatives (FN), and True Negatives (TN) into the Confusion Matrix Calculator to evaluate your classification model's performance. You get back key metrics including Accuracy, Precision, Recall (Sensitivity), Specificity, F1 Score, Matthews Correlation Coefficient, and more — everything you need to assess how well your ML model is performing.

Cases correctly predicted as Positive

Cases incorrectly predicted as Positive (Type I error)

Cases incorrectly predicted as Negative (Type II error)

Cases correctly predicted as Negative

Results

Accuracy

--

Precision (PPV)

--

Recall (Sensitivity / TPR)

--

Specificity (TNR)

--

F1 Score

--

Matthews Correlation Coefficient (MCC)

--

Negative Predictive Value (NPV)

--

False Positive Rate (FPR)

--

False Discovery Rate (FDR)

--

False Negative Rate (FNR)

--

Total Samples

--

Confusion Matrix Breakdown

Results Table

Frequently Asked Questions

What is a confusion matrix in machine learning?

A confusion matrix is a table used to evaluate the performance of a classification model by comparing predicted labels against actual labels. It contains four key values: True Positives (TP), True Negatives (TN), False Positives (FP), and False Negatives (FN). From these four values, a wide range of performance metrics can be derived.

How do I read a confusion matrix?

A standard 2×2 confusion matrix has actual classes on one axis and predicted classes on the other. The top-left cell is True Positives (correctly predicted positive), top-right is False Negatives (positive predicted as negative), bottom-left is False Positives (negative predicted as positive), and bottom-right is True Negatives (correctly predicted negative). The diagonal cells represent correct predictions.

What is the difference between accuracy and precision?

Accuracy measures the proportion of all correct predictions out of total samples — (TP + TN) / Total. Precision measures how many of the positive predictions were actually correct — TP / (TP + FP). Precision is more relevant when the cost of false positives is high, while accuracy gives a broader view of overall model correctness.

What is Recall (Sensitivity) and when should I prioritize it?

Recall (also called Sensitivity or True Positive Rate) measures how many actual positives the model correctly identified — TP / (TP + FN). It is most important in scenarios where missing a positive case is costly, such as disease diagnosis or fraud detection, where a False Negative has serious consequences.

What is the F1 Score and why is it useful?

The F1 Score is the harmonic mean of Precision and Recall: 2TP / (2TP + FP + FN). It is especially useful when the dataset is imbalanced, as it balances both false positives and false negatives into a single metric. A perfect F1 Score is 1.0, and the worst is 0.

What is the Matthews Correlation Coefficient (MCC)?

The MCC is a balanced metric that considers all four confusion matrix values — TP, TN, FP, and FN. It returns a value between -1 and +1, where +1 is a perfect prediction, 0 is equivalent to random guessing, and -1 indicates complete disagreement. It is particularly reliable for imbalanced datasets.

What is Specificity and how does it differ from Recall?

Specificity (True Negative Rate) measures how well the model identifies actual negatives — TN / (TN + FP). While Recall focuses on correctly capturing positive cases, Specificity focuses on correctly identifying negative cases. Both metrics are important in medical testing, where you want high sensitivity and high specificity.

How do I find precision for 80 true positives and 20 false positive samples?

Using the formula Precision = TP / (TP + FP), you would calculate 80 / (80 + 20) = 80 / 100 = 0.80, or 80%. This means 80% of all positive predictions made by the model were actually correct.

More Statistics Tools