Calculation result
Enter data and calculate to view MCC results.
Supporting metrics
| Metric | Value | Meaning |
|---|
Interpretation
Formula and steps
Confusion matrix
Threshold analysis
| Threshold | MCC | Accuracy | F1 |
|---|
Model ranking
Choose calculation mode
Formula used
MCC = (TP × TN − FP × FN) ÷ √[(TP + FP)(TP + FN)(TN + FP)(TN + FN)]
MCC = (c × s − Σ pₖtₖ) ÷ √[(s² − Σpₖ²)(s² − Σtₖ²)]
Here, c is the confusion-matrix trace. The value s is the total sample count. Values pₖ and tₖ are predicted and actual class totals.
How to use this calculator
- Select the input mode matching your available data.
- Enter counts, labels, probabilities, or a multiclass matrix.
- Choose precision and threshold settings when applicable.
- Calculate and inspect MCC, supporting metrics, and warnings.
- Copy, print, or export the completed results.
Example data
| Scenario | TP | TN | FP | FN | Expected pattern |
|---|---|---|---|---|---|
| Perfect prediction | 100 | 100 | 0 | 0 | MCC equals +1 |
| Strong balanced model | 90 | 88 | 12 | 10 | High positive MCC |
| Imbalanced model | 40 | 900 | 50 | 60 | MCC reveals minority-class weakness |
| Near-random model | 50 | 50 | 50 | 50 | MCC near zero |
| Reversed prediction | 0 | 0 | 100 | 100 | MCC equals −1 |
Understanding Matthews correlation coefficient
MCC measures agreement between observed and predicted classes. It uses every confusion-matrix cell. This makes it valuable for imbalanced classification tasks.
MCC ranges from negative one to positive one. Positive one indicates perfect prediction. Zero indicates performance similar to random assignment.
Negative values indicate systematic disagreement between predictions and labels. A reversed classifier can approach negative one. Context should guide every practical interpretation decision.
Frequently asked questions
1. Why use MCC instead of accuracy?
Accuracy can look strong when one class dominates. MCC includes all confusion-matrix outcomes. It therefore exposes many misleading imbalanced results.
2. What does MCC equal to zero mean?
It usually indicates little linear association between predictions and labels. Performance may resemble random assignment. Dataset structure still matters during interpretation.
3. Can MCC be negative?
Yes. Negative MCC indicates inverse agreement. Strongly reversed predictions can approach negative one.
4. Is MCC useful for multiclass problems?
Yes. The generalized formula supports multiclass confusion matrices. Per-class one-versus-rest values provide additional detail.
5. When is MCC undefined?
MCC is undefined when its denominator becomes zero. This often occurs with absent classes. The calculator reports that condition clearly.
6. How does MCC differ from F1 score?
F1 emphasizes precision and recall for a chosen positive class. MCC also uses true negatives. This provides a more balanced summary.
7. Can probabilities be used directly?
Probabilities must first become class predictions using a threshold. This calculator evaluates selected and optimized thresholds. It also displays threshold performance tables.
8. Which threshold should I choose?
The highest MCC threshold is one useful choice. Business costs may require another threshold. Review precision, recall, and error consequences.
9. Is a high MCC always sufficient?
No single metric captures every deployment concern. Check calibration, subgroup performance, and operational costs. Validate results on unseen representative data.