Overview
The Matthews correlation coefficient, or MCC, scores a yes/no classifier using all four parts of the confusion matrix. It stays honest when one class is much bigger than the other.
Enter true positives, true negatives, false positives and false negatives.
Worked examples
| Inputs | Result |
|---|---|
| True Positives88True Negatives170False Positives12False Negatives20 | Matthews correlation coefficient (MCC): 0.76Accuracy: 88.97% |
Show 2 more examples
| True Positives50True Negatives50False Positives0False Negatives0 | Matthews correlation coefficient (MCC): 1Accuracy: 100% |
| True Positives30True Negatives30False Positives20False Negatives20 | Matthews correlation coefficient (MCC): 0.2Accuracy: 60% |
Matthews correlation coefficient (MCC) by true positives
With the calculator's starting values, the matthews correlation coefficient (MCC) is 0.76. The table shows how it changes with the true positives.
| True Positives | Matthews correlation coefficient (MCC) |
|---|---|
| 60 | 0.71 |
| 80 | 0.75 |
| 88starting value | 0.76 |
| 100 | 0.78 |
| 120 | 0.8 |
Other inputs: True Negatives: 170 · False Positives: 12 · False Negatives: 20. Change them in the calculator above for your own numbers.
How it works
MCC behaves like a correlation between predictions and reality. It runs from −1, where every prediction is wrong, through 0, no better than chance, to +1, a perfect classifier. Unlike accuracy, a model can't score well just by predicting the bigger class.
The formula
| TP, TN | Correct positives and negatives |
| FP, FN | False positives and false negatives |
Common mistakes
- Looking only at accuracy on imbalanced data.
- Swapping false positives and false negatives.
- Treating MCC as a percentage instead of a -1 to 1 score.
Practical tips
- 88 TP, 170 TN, 12 FP and 20 FN give an MCC of 0.76 and accuracy of 88.97%.
- If any row or column of the matrix is empty, the formula divides by zero, so MCC is undefined.
- MCC is often recommended over F1 for imbalanced binary problems.
Frequently asked questions
What is a good MCC score?
MCC ranges from -1 to 1. Values closer to 1 indicate stronger classification performance.
Why use MCC instead of accuracy?
MCC handles class imbalance better because it uses TP, TN, FP, and FN together.
Can MCC be negative?
Yes. A negative MCC means predictions are worse than random in the opposite direction.
What is a good MCC?
Above about 0.5 is usually solid, and above 0.8 is strong, but compare against other models on the same data.
Is MCC the same as the phi coefficient?
Yes, for a 2 × 2 table they are the same number.
Why is my MCC low when accuracy is high?
Usually because the classes are imbalanced and the model is weak on the smaller one.