Quant Memo
Core

Matthews Correlation Coefficient

The Matthews Correlation Coefficient (MCC) is a single score summarizing a binary classifier's performance from all four cells of its confusion matrix at once, which makes it far more honest than accuracy on imbalanced data.

Accuracy alone is a misleading way to score a classifier when one class is rare: a model that predicts "no fraud" every single time can be 99% accurate on a dataset where fraud is 1% of cases, while catching zero actual fraud. The Matthews Correlation Coefficient fixes this by using all four numbers in a confusion matrix — true positives, true negatives, false positives, and false negatives — together, rather than only the two that make up accuracy.

MCC ranges from -1 (total disagreement) through 0 (no better than random) to +1 (perfect prediction), and unlike plain accuracy it stays informative even when one class is rare, because it's built from all four confusion-matrix cells at once rather than just the correct-prediction count.

The formula is:

MCC=TP×TNFP×FN(TP+FP)(TP+FN)(TN+FP)(TN+FN)MCC = \frac{TP \times TN - FP \times FN}{\sqrt{(TP+FP)(TP+FN)(TN+FP)(TN+FN)}}

In words: the numerator rewards getting both positives and negatives right while penalizing both kinds of mistakes; the denominator normalizes for the sizes of the predicted and actual classes, so a model can't inflate its score just by knowing the class proportions.

Worked example. Of 1,000 loan applications, 50 actually default. A model predicts 40 true positives, 10 false negatives, 30 false positives, and 920 true negatives. Accuracy looks strong at 96%, but MCC is (40×92030×10)/70×50×950×93036,500/57,3260.64\left(40 \times 920 - 30 \times 10\right) / \sqrt{70 \times 50 \times 950 \times 930} \approx 36{,}500 / 57{,}326 \approx 0.64 — a solid but far more sober score than the 96% accuracy figure suggests, reflecting that a meaningful chunk of both defaults and non-defaults were still misclassified.

MCC is especially useful in finance, where the interesting class — fraud, default, a rare regime shift — is almost always the minority one that accuracy tends to flatter.

Related concepts

Practice in interviews

Further reading

  • Matthews, 'Comparison of the Predicted and Observed Secondary Structure of T4 Phage Lysozyme'
ShareTwitterLinkedIn