Matthews correlation coefficient

The Matthews correlation coefficient (MCC) is a measure of the quality of binary (two-class) classifications.

It takes into account true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN) to provide a balanced measure of how well the classification performs.

How to calculate

$$ MCC = (TP * TN - FP * FN) / sqrt((TP + FP) * (TP + FN) * (TN + FP) * (TN + FN)) $$

where TP, TN, FP, and FN represent the number of true positives, true negatives, false positives, and false negatives, respectively.

The MCC ranges from -1 to +1,

where 1 indicates a perfect prediction, 0 indicates a random prediction, and -1 indicates a completely incorrect prediction.

  • The MCC is particularly useful when dealing with imbalanced datasets,
  • where the number of instances in one class is much larger than the other.
  • In such cases, accuracy may be a misleading metric, as a model that always predicts the majority class will have high accuracy,
  • but may not be useful in practice.
  • MCC provides a balanced measure of the quality of the classification, taking into account both positive and negative predictions.

Related Topics