mplot_gain | R Documentation |
The cumulative gains plot, often named ‘gains plot’, helps us answer the question: When we apply the model and select the best X deciles, what expect to target? The cumulative gains chart shows the percentage of the overall number of cases in a given category "gained" by targeting a percentage of the total number of cases.
mplot_gain(
tag,
score,
multis = NA,
target = "auto",
splits = 10,
highlight = "auto",
caption = NA,
save = FALSE,
subdir = NA,
file_name = "viz_gain.png",
quiet = FALSE
)
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). |
target |
Value. Which is your target positive value? If set to 'auto', the target with largest mean(score) will be selected. Change the value to overwrite. Only works for binary classes |
splits |
Integer. Numer of quantiles to split the data |
highlight |
Character or Integer. Which split should be used for the automatic conclussion in the plot? Set to "auto" for best value, "none" to turn off or the number of split. |
caption |
Character. Caption to show in 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 |
quiet |
Boolean. Do not show message for auto target? |
Plot with gain and performance results by cuts.
Other ML Visualization:
mplot_conf()
,
mplot_cuts()
,
mplot_cuts_error()
,
mplot_density()
,
mplot_full()
,
mplot_importance()
,
mplot_lineal()
,
mplot_metrics()
,
mplot_response()
,
mplot_roc()
,
mplot_splits()
,
mplot_topcats()
Sys.unsetenv("LARES_FONT") # Temporal
data(dfr) # Results for AutoML Predictions
lapply(dfr, head)
# Plot for Binomial Model
mplot_gain(dfr$class2$tag, dfr$class2$scores,
caption = "Titanic Survived Model",
target = "FALSE"
)
mplot_gain(dfr$class2$tag, dfr$class2$scores,
caption = "Titanic Survived Model",
target = "TRUE"
)
# Plot for Multi-Categorical Model
mplot_gain(dfr$class3$tag, dfr$class3$score,
multis = subset(dfr$class3, select = -c(tag, score)),
caption = "Titanic Class Model"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.