matthews-correlation-coefficient · shipping · also MCC, phi coefficient

Matthews correlation coefficient

For binary classification, the Matthews correlation coefficient is the Pearson correlation between predicted class labels and observed outcomes, calculated from all four confusion-matrix counts.

MCC = (TP*TN - FP*FN) / sqrt((TP+FP)*(TP+FN)*(TN+FP)*(TN+FN)), where TP, FP, FN and TN count true positives, false positives, false negatives and true negatives in the same evaluation population. When defined, it ranges from -1 for complete disagreement to +1 for complete agreement; zero means zero binary correlation, not proof of a particular guessing mechanism. [1]

If either labels or predictions are constant, the denominator is zero and the correlation is undefined. scikit-learn 1.7.2 returns 0.0 in this case; Hesela's accompanying calculation returns null to keep that distinction visible. [2]

Relations

related
f1-score, precision, recall, false-positive-rate, class-prevalence, probability-calibration

Limitations

Citations

  1. scikit-learn: Matthews correlation coefficient and binary confusion-matrix formula. (accessed 2026-10-17)
  2. scikit-learn 1.7.2: matthews_corrcoef, zero-denominator convention. (accessed 2026-10-17)

Further reading

  1. Hesela: synthetic ranking, decision and calibration example; not measured drive results. (accessed 2026-10-17)

JSON: /data/terms/matthews-correlation-coefficient.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Matthews correlation coefficient. Hesela. 2026-10-17. https://hesela.dev/terms/matthews-correlation-coefficient/