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:
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 — 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.
Practice in interviews
Further reading
- Matthews, 'Comparison of the Predicted and Observed Secondary Structure of T4 Phage Lysozyme'