Implementation based on https://stackoverflow.com/a/59119854

confusion_matrix(actual_y, predicted_y, labels = NULL, title = NULL)

Arguments

actual_y

a data frame of the validation labels

predicted_y

a data frame of predicted values with model

labels

a list of string of confusion matrix labels

title

a string of the confusion matrix label

Value

A plot and a dataframe with scoring metrics

Examples

confusion_matrix(as.factor(c("yes", "no", "yes")), as.factor(c("no", "no", "yes")))
#> confusion_matrix$byClass #> Sensitivity 1.0000000 #> Specificity 0.5000000 #> Pos Pred Value 0.5000000 #> Neg Pred Value 1.0000000 #> Precision 0.5000000 #> Recall 1.0000000 #> F1 0.6666667 #> Prevalence 0.3333333 #> Detection Rate 0.3333333 #> Detection Prevalence 0.6666667 #> Balanced Accuracy 0.7500000