Home Back

4x4 Confusion Matrix Calculator

Confusion Matrix Metrics:

\[ \text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} \] \[ \text{Precision} = \frac{TP}{TP + FP} \] \[ \text{Recall/Sensitivity} = \frac{TP}{TP + FN} \] \[ \text{Specificity} = \frac{TN}{TN + FP} \] \[ F1\text{-score} = 2 \times \frac{Precision \times Recall}{Precision + Recall} \]

Actual vs Predicted Values

Predicted Class 1 Predicted Class 2 Predicted Class 3 Predicted Class 4
Actual Class 1
Actual Class 2
Actual Class 3
Actual Class 4

Results

Unit Converter ▲

Unit Converter ▼

From: To:

1. What is a 4x4 Confusion Matrix?

A 4x4 confusion matrix is a table that visualizes the performance of a classification model with four classes. It shows how many predictions were correct (diagonal) and incorrect (off-diagonal) for each class.

2. How Does the Calculator Work?

The calculator computes various metrics for each class:

\[ \text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} \] \[ \text{Precision} = \frac{TP}{TP + FP} \] \[ \text{Recall/Sensitivity} = \frac{TP}{TP + FN} \] \[ \text{Specificity} = \frac{TN}{TN + FP} \] \[ F1\text{-score} = 2 \times \frac{Precision \times Recall}{Precision + Recall} \]

Where:

3. Importance of Confusion Matrix Analysis

Details: Confusion matrices help identify which classes are being confused with others, allowing for targeted model improvement. They provide more insight than simple accuracy metrics.

4. Using the Calculator

Tips: Enter the counts of actual vs predicted classifications in the 4x4 grid. The calculator will compute metrics for each class and overall accuracy.

5. Frequently Asked Questions (FAQ)

Q1: What's the difference between precision and recall?
A: Precision measures how many selected items are relevant, while recall measures how many relevant items are selected.

Q2: When should I use F1-score?
A: F1-score is useful when you want to balance precision and recall, especially with imbalanced datasets.

Q3: What does specificity measure?
A: Specificity measures the proportion of actual negatives that are correctly identified.

Q4: How do I interpret off-diagonal elements?
A: Off-diagonal elements show misclassifications - which classes are being confused with which others.

Q5: Can I use this for binary classification?
A: While you can, a 2x2 matrix would be simpler for binary classification cases.

4x4 Confusion Matrix Calculator© - All Rights Reserved 2025