MCC-F1 curve: a performance evaluation technique for binary classification
Based on the paper - The MCC-F1 curve: a performance evaluation technique for binary classification (Cao, Chicco, & Hoffman, 2020), wherein the authors combine two single-threshold metrics i.e. Matthews correlation coefficient (MCC) and the πΉ1 score. into a MCC-F1 curve and also compute a metric that integrates the MCC-F1 curve inorder to compare classifier performance across varying thresholds.
The code computes the MCC-F1 curve and its relevant metrics.
- Based on 2 input values - Ground truths and Predicted values (given by a binary classifer);
- The MCC-F1 function calculates the MCC and F1 scores across varying thresholds.
- The MCC-F1 metric provides a measure to compare classifers, and provides the the best threshold π the point on the MCC-πΉ1 curve closest to the point of perfect performance (1,1)
- Plotting the MCC-F1 curve.
Based on the inputs of ground truths and predicted values; we can calculate Matthews correlation coefficient (MCC) and the πΉ1 scores which are scoring classifiers. This results in a real-valued prediction score π(π₯π) for each element, and then assigning positive predictions (π¦πΜ = 1) when the score exceeds some threshold π, or negative predictions (π¦πΜ = 0).
Based on the MCC-F1 scores calulated we can compute the MCC-F1 Metric based on the following steps:
- Divide the normalized MCC in the curve [minπ ππ, maxπ ππ] into π = 100 sub-ranges, each of width π€ = (maxπ ππ β minπ ππ)/π.
- calculate the mean Euclidean distance between points with MCC in each sub-range to the point of perfect performance (1,1).
- Calculate grand average i.e. averaged the mean distances amongst subranges.
- Better classifiers have MCC-πΉ1 curves closer to the point of perfect performance (1,1), and have a larger MCC-πΉ1 metric.