Classification
Matthews correlation coefficient
Implemented
classification.mccDefinition
Correlation between observed and predicted binary labels that uses all four confusion-matrix cells.
Formula
MCC = (TP·TN − FP·FN) / √((TP+FP)(TP+FN)(TN+FP)(TN+FN))
Range: [−1, 1]
Inputs and outputs
- y_true: array of class labels
- y_pred: array of predicted labels
Returns: float
Assumptions
No assumptions beyond valid, aligned inputs of the documented types.
Limitations
- Undefined when any marginal of the confusion matrix is zero; EvalSuite reports this explicitly rather than returning a silent value.
Python API
import evalsuite as es
es.mcc(y_true, y_pred)References
- Matthews, B. W. (1975). Comparison of the predicted and observed secondary structure of T4 phage lysozyme. Biochimica et Biophysica Acta, 405(2), 442–451.