# NOT RUN {
library(ggplot2)
library(dplyr)
# Two class - a tibbble is returned
roc_curve(two_class_example, truth, Class1)
# Visualize the curve using ggplot2 manually
roc_curve(two_class_example, truth, Class1) %>%
ggplot(aes(x = 1 - specificity, y = sensitivity)) +
geom_path() +
geom_abline(lty = 3) +
coord_equal() +
theme_bw()
# Or use autoplot
autoplot(roc_curve(two_class_example, truth, Class1))
# }
# NOT RUN {
# Multiclass one-vs-all approach
# One curve per level
hpc_cv %>%
filter(Resample == "Fold01") %>%
roc_curve(obs, VF:L) %>%
autoplot()
# Same as above, but will all of the resamples
hpc_cv %>%
group_by(Resample) %>%
roc_curve(obs, VF:L) %>%
autoplot()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab