
Last chance! 50% off unlimited learning
Sale ends in
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
)
Plot with gain and performance results by cuts.
Vector. Real known label.
Vector. Predicted value or model's result.
Data.frame. Containing columns with each category probability or score (only used when more than 2 categories coexist).
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
Integer. Numer of quantiles to split the data
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.
Character. Caption to show in plot
Boolean. Save output plot into working directory
Character. Sub directory on which you wish to save the plot
Character. File name as you wish to save the plot
Boolean. Do not show message for auto target?
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"
)
Run the code above in your browser using DataLab