Matthews Correlation Coefficient
What you'll learn: How Matthews Correlation Coefficient (MCC) provides a single, balanced performance metric that works reliably even when your dataset has severe class imbalance.
Why MCC Stands Out
You've learned many classification metrics—accuracy, precision, recall, F1 score, Cohen's Kappa—but Matthews Correlation Coefficient is special because it considers all four cells of the confusion matrix equally. This makes it incredibly robust when classes are heavily imbalanced.
The Core Idea
MCC is essentially a correlation coefficient between your predicted labels and actual labels. It returns a value between -1 and +1:
- +1 = perfect prediction
- 0 = no better than random guessing
- -1 = total disagreement (predicting the exact opposite)
Unlike accuracy (which can look great even on terrible imbalanced-class models) or F1 (which ignores true negatives), MCC balances true positives, true negatives, false positives, and false negatives simultaneously.
When to Use MCC
Imagine a medical test for a rare disease affecting 1% of the population. A lazy model predicting "healthy" for everyone gets 99% accuracy but is completely useless. Cohen's Kappa would reveal this, but MCC goes further—it treats both classes symmetrically and won't be fooled by imbalance in any direction.
MCC is particularly valuable when:
- Classes are severely imbalanced
- Both positive and negative predictions matter equally
- You need one number that reflects overall classification quality
The Balance Advantage
Because MCC incorporates all confusion matrix values with equal weight, a high MCC score guarantees your model performs well across both classes—you can't game it by optimizing just precision or just recall.
Key Takeaway: Matthews Correlation Coefficient is the most balanced single metric for classification, accounting for all confusion matrix cells equally and remaining reliable even with extreme class imbalance.