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

InputsResult
True Positives88True Negatives170False Positives12False Negatives20Matthews correlation coefficient (MCC): 0.76Accuracy: 88.97%
Show 2 more examples
True Positives50True Negatives50False Positives0False Negatives0Matthews correlation coefficient (MCC): 1Accuracy: 100%
True Positives30True Negatives30False Positives20False Negatives20Matthews 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 PositivesMatthews correlation coefficient (MCC)
600.71
800.75
88starting value0.76
1000.78
1200.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

MCC = (TP × TN − FP × FN) ÷ √((TP+FP)(TP+FN)(TN+FP)(TN+FN))
TP, TNCorrect positives and negatives
FP, FNFalse 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.