The Matthews correlation coefficient (MCC) or phi coefficient is an evaluation metric for binary classification invented by Brian Matthews in 1975. The MCC is a correlation coefficient for target and predictions and varies between -1 and 1 (best agreement). MCC is a very good way to summarize the confusion matrix (refer to the Getting classification straight with the confusion matrix recipe) as it uses all four numbers in it. The MCC is given by the following equation:
The imports are as follows:
import dautil as dl from sklearn import metrics import numpy as np import ch10util from IPython.display import HTML
Calculate accuracies, precisions, recalls, F1-scores, and Matthews correlation coefficients for the rain predictors:
y_test = np.load('rain_y_test.npy') accuracies = [metrics.accuracy_score(y_test, preds) for preds in ch10util.rain_preds()] precisions = [metrics.precision_score(y_test, preds) ...