How this calculator works
MCC is the Pearson correlation between binary actual labels and predicted labels. It uses all four cells, making it useful when accuracy alone hides class imbalance. Values range from -1 for complete reversal to +1 for perfect agreement. A zero marginal total makes the mathematical correlation undefined; this tool returns an error rather than adopting a software-specific zero convention.
Formula
MCC = (TP × TN - FP × FN)/sqrt((TP + FP)(TP + FN)(TN + FP)(TN + FN)). Accuracy = (TP + TN)/N.
Worked example
TP = 3, TN = 4, FP = 1 and FN = 2 give numerator 10 and denominator sqrt(600). MCC is about 0.408248 and accuracy is 70%.
Advertisement
Frequently asked questions
What counts as a false positive?
A predicted positive whose actual label is negative. Use a consistent choice of positive class for all four cells.
Can this handle several classes?
This page accepts a binary confusion matrix. Multiclass MCC requires the full multiclass matrix and a generalised formula.
Is zero always random guessing?
It indicates zero binary correlation for the supplied matrix. Interpretation still depends on the prediction and class-generation processes.