Advertisement

Matthews correlation coefficient calculator

Enter the four counts from a binary classification confusion matrix. Counts must be whole numbers and describe the same evaluation set.

Calculator

Matthews correlation coefficient
0.797980
Accuracy
90.000000%
Positive predictive precision
90.909091%
Recall (sensitivity)
90.909091%
Specificity
88.888889%
F1 score
0.909091
Confusion matrix
Actual classPredicted positivePredicted negative
Positive50.0000005.000000
Negative5.00000040.000000

Advertisement

How this calculator works

MCC is the Pearson correlation between binary actual labels and predicted labels. It uses all four cells, making it useful when accuracy alone hides class imbalance. Values range from -1 for complete reversal to +1 for perfect agreement. A zero marginal total makes the mathematical correlation undefined; this tool returns an error rather than adopting a software-specific zero convention.

Formula

MCC = (TP × TN - FP × FN)/sqrt((TP + FP)(TP + FN)(TN + FP)(TN + FN)). Accuracy = (TP + TN)/N.

Worked example

TP = 3, TN = 4, FP = 1 and FN = 2 give numerator 10 and denominator sqrt(600). MCC is about 0.408248 and accuracy is 70%.

Advertisement

Frequently asked questions

What counts as a false positive?

A predicted positive whose actual label is negative. Use a consistent choice of positive class for all four cells.

Can this handle several classes?

This page accepts a binary confusion matrix. Multiclass MCC requires the full multiclass matrix and a generalised formula.

Is zero always random guessing?

It indicates zero binary correlation for the supplied matrix. Interpretation still depends on the prediction and class-generation processes.

Sources

Advertisement