What is Matthews Correlation Coefficient (MCC)?

Matthews Correlation Coefficient (MCC) is a correlation-based classification metric that uses all cells of the confusion matrix to measure agreement between actual and predicted labels.

Quick Facts

CreatedIntroduced by Brian W. Matthews in 1975
SpecificationOfficial Specification

How It Works

Interpret correlation with counts and uncertainty

Matthews introduced the coefficient in 1975 while comparing predicted and observed protein secondary structure. There is no universal table that makes a particular MCC value good enough for every task. Report TP, FP, TN, FN, prevalence, threshold, uncertainty, and material slices. Chicco and Jurman compare MCC, F1, and Accuracy across imbalanced binary cases and document extreme denominator behavior.

Handle zero denominators explicitly

The binary denominator becomes zero when an actual or predicted class is absent. That is an evidence condition, not an invitation to divide silently or invent a perfect score. Record the degenerate matrix and follow a versioned library or evaluation policy. Current scikit-learn documentation provides binary and multiclass implementations; reproducible comparisons must keep implementation and weighting fixed.

Distinguish binary MCC from multiclass generalization

The familiar four-count formula applies only to binary classification. Multiclass MCC generalizes correlation using the full K x K contingency matrix rather than averaging independent binary formulas. Publish the class set and confusion matrix, and retain per-class Precision and Recall because one global correlation value does not explain which classes fail.

Key Characteristics

  • Uses true positives, true negatives, false positives, and false negatives
  • Equals the phi correlation between binary actual and predicted labels
  • Is symmetric under a consistent swap of positive and negative class names
  • Can expose majority-class behavior that Accuracy or positive-class F1 obscures
  • Becomes degenerate when an actual or predicted class has zero support
  • Has a multiclass generalization based on the complete contingency matrix

Common Use Cases

  1. Comparing binary classifiers when both classes must be predicted well
  2. Checking a high Accuracy or F1 result on imbalanced data
  3. Monitoring fixed-threshold quality after class prevalence changes
  4. Evaluating multiclass label agreement with one complementary global statistic
  5. Auditing model releases alongside per-class errors and operational costs

Example

loading...
Loading code...

Frequently Asked Questions

How is the Matthews Correlation Coefficient calculated?

For binary data, subtract `FP*FN` from `TP*TN`, then divide by the square root of `(TP+FP)(TP+FN)(TN+FP)(TN+FN)`. Publish all four counts, class meaning, threshold, weighting, and the policy used if the denominator is zero.

Why is MCC useful for imbalanced classification?

MCC incorporates both correct classes and both error types, so a model must align actual and predicted labels across the complete binary table to score highly. This reduces the chance that majority-class Accuracy or positive-class F1 alone hides failure, but it does not remove sampling uncertainty.

What does an MCC of zero mean?

It means zero measured linear association between actual and predicted labels in that evaluated sample and implementation. It does not prove that every prediction was generated randomly, and it should be interpreted with counts, uncertainty, slices, and a task-specific baseline.

Is MCC always better than F1 Score?

No. MCC is a stronger balanced summary when both binary classes matter, while F1 deliberately focuses on positive-class Precision and Recall. Neither encodes actual error costs. Report the metric whose assumptions match the decision, plus the confusion matrix and classwise results.

Can MCC be used for multiclass classification?

Yes, with a generalized formula over the complete multiclass contingency matrix. Do not apply the four-cell binary equation independently and label the result multiclass MCC. Publish the library implementation, class set, weighting, confusion matrix, and per-class metrics.

Related Terms

Related Articles