##################################################
### A single model, true and false positive rates
###
roc_df <- data.frame(
threshold = c(0.9, 0.7, 0.5, 0.3, 0.1),
tpr = c(0.2, 0.5, 0.7, 0.9, 1.0),
fpr = c(0.02, 0.10, 0.25, 0.55, 1.0)
)
pts1 <- format_points(roc_df,
threshold_col = "threshold",
tpr_col = "tpr", fpr_col = "fpr",
np = 50, nn = 100
)
evalmod(mmdata(pts1$scores, pts1$labels))
##################################################
### Two models, recall and precision
###
prc_df <- data.frame(
model = rep(c("m1", "m2"), each = 4),
threshold = rep(c(0.8, 0.6, 0.4, 0.2), 2),
recall = c(0.3, 0.6, 0.8, 1.0, 0.2, 0.4, 0.7, 1.0),
precision = c(0.9, 0.8, 0.6, 0.4, 0.7, 0.6, 0.5, 0.4)
)
pts2 <- format_points(prc_df,
threshold_col = "threshold",
rec_col = "recall", prec_col = "precision",
mod_col = "model", np = 40, nn = 60
)
evalmod(mmdata(pts2$scores, pts2$labels, modnames = pts2$modnames))
Run the code above in your browser using DataLab