This function plots ROC Curves with AUC values with 95% confidence range. It also works for multi-categorical models.
Usage
mplot_roc(
tag,
score,
multis = NA,
sample = 1000,
model_name = NA,
subtitle = NA,
interval = 0.2,
squared = TRUE,
plotly = FALSE,
save = FALSE,
subdir = NA,
file_name = "viz_roc.png"
)
Arguments
- tag
Vector. Real known label.
- score
Vector. Predicted value or model's result.
- multis
Data.frame. Containing columns with each category probability or score (only used when more than 2 categories coexist).
- sample
Integer. Number of samples to use for rendering plot.
- model_name
Character. Model's name
- subtitle
Character. Subtitle to show in plot
- interval
Numeric. Interval for breaks in plot
- squared
Boolean. Keep proportions?
- plotly
Boolean. Use plotly for plot's output for an interactive plot
- save
Boolean. Save output plot into working directory
- subdir
Character. Sub directory on which you wish to save the plot
- file_name
Character. File name as you wish to save the plot
See also
Other ML Visualization:
mplot_conf()
,
mplot_cuts()
,
mplot_cuts_error()
,
mplot_density()
,
mplot_full()
,
mplot_gain()
,
mplot_importance()
,
mplot_lineal()
,
mplot_metrics()
,
mplot_response()
,
mplot_splits()
,
mplot_topcats()
Examples
Sys.unsetenv("LARES_FONT") # Temporal
data(dfr) # Results for AutoML Predictions
lapply(dfr[c(1, 2)], head)
#> $class2
#> tag scores
#> 1 TRUE 0.3155498
#> 2 TRUE 0.8747599
#> 3 TRUE 0.8952823
#> 4 FALSE 0.0436517
#> 5 TRUE 0.2196593
#> 6 FALSE 0.2816101
#>
#> $class3
#> tag score n_1 n_2 n_3
#> 1 n_3 n_2 0.20343865 0.60825062 0.18831071
#> 2 n_2 n_3 0.17856154 0.07657769 0.74486071
#> 3 n_1 n_1 0.50516951 0.40168718 0.09314334
#> 4 n_3 n_2 0.30880713 0.39062151 0.30057135
#> 5 n_2 n_3 0.01956827 0.07069011 0.90974158
#> 6 n_2 n_3 0.07830017 0.15408720 0.76761264
#>
# ROC Curve for Binomial Model
mplot_roc(dfr$class2$tag, dfr$class2$scores,
model_name = "Titanic Survived Model"
)
# ROC Curves for Multi-Categorical Model
mplot_roc(dfr$class3$tag, dfr$class3$score,
multis = subset(dfr$class3, select = -c(tag, score)),
squared = FALSE,
model_name = "Titanic Class Model"
)