Confusion Matrix Calculator

Build confusion matrices, calculate classification metrics, analyse thresholds, compare models, inspect class errors, and export clear machine learning evaluation reports instantly for better decisions.

Evaluation Results

Enter data and calculate a confusion matrix.

Confusion Matrix

Matrix Heatmap

Per-Class Metrics

Metric Comparison

Interpretation

No interpretation is available yet.

Validation and Warnings

No validation messages.

Formula Used

Formulas appear after calculation.

Step-by-Step Calculation

Calculation steps appear here.

Saved Model Comparison

Save calculated model snapshots to compare performance.

1. Input Method

Separate class names with commas.

2. Metric and Cost Options

The active input tab controls the calculation source.

How to Use

  1. Select binary counts, labels, probabilities, manual matrix, or file import.
  2. Enter valid classification data and choose calculation options.
  3. Press calculate to generate the matrix and metrics.
  4. Review warnings, interpretation, formulas, and class-level results.
  5. Copy, print, or export the completed evaluation report.

Example Data

ActualPredictedMeaning
PositivePositiveTrue positive
NegativeNegativeTrue negative
NegativePositiveFalse positive
PositiveNegativeFalse negative

Frequently Asked Questions

What is a confusion matrix?

It compares actual classes with predicted classes. Correct results appear on the main diagonal. Errors appear outside that diagonal.

Which axis represents actual classes?

This calculator displays actual classes as rows. Predicted classes appear as columns. Labels remain visible in every matrix.

What happens when a denominator is zero?

The affected metric displays N/A. This avoids misleading infinite or undefined values. A warning explains the issue clearly.

Why can accuracy be misleading?

Large majority classes can dominate overall accuracy. Minority performance may still remain poor. Review recall and balanced accuracy too.

What is macro averaging?

Macro averaging gives every class equal importance. It averages each class metric directly. Class frequency does not change weighting.

What is weighted averaging?

Weighted averaging uses class support as weights. Larger classes influence results more strongly. It reflects the observed class distribution.

What is micro averaging?

Micro averaging combines decisions across all classes. It totals contributions before calculating metrics. Larger classes naturally contribute more.

How is the best threshold selected?

The calculator evaluates candidate probability thresholds. It compares the chosen optimisation metric. The strongest valid threshold is selected.

Can I import spreadsheet data?

Yes, upload CSV or TSV files. Select actual and predicted columns. Optional probability and weight columns are supported.

Related Calculators

Classification Accuracy CalculatorRecall CalculatorSpecificity CalculatorSensitivity CalculatorFalse Positive Rate CalculatorFalse Negative Rate CalculatorMatthews Correlation Coefficient CalculatorBalanced Accuracy CalculatorLog Loss CalculatorBinary Cross-Entropy Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.