powered by
Given binary observed and predicted response, estimate Matthews correlation coefficient (MCC) and the F1 score.
calculate_mcc_f1(observed, predicted)
A list with two elements: mcc and f1.
mcc
f1
logical or 0/1; the observed binary response.
logical or 0/1; the predicted binary response. This will typically need to be generated by applying a threshold to the continuous predicted response.
obs <- c(rep(1L, 1000L), rep(0L, 10000L)) pred <- c(rbeta(300L, 12, 2), rbeta(700L, 3, 4), rbeta(10000L, 2, 3)) calculate_mcc_f1(obs > 0, pred > 0.5)
Run the code above in your browser using DataLab