Plots cumulative gains curves for one or more competing scores against a perfect model baseline. The Gini coefficient for each score is shown in the legend.
Arguments
- data
A
modelblueprintobject.- ...
Passed to the default method.
- set
[character]Dataset splits to use: any of"train","test","holdout". Defaults to all available (non-NULL) sets. When more than one set is used, a named list with one result per set is returned.- title
Chart title. Defaults to
model_display_name(with the set name appended when plotting multiple sets).- ret
"plot","data", or"gini". Default"plot".- precomputed_preds
[numeric | NULL]Optional vector of pre-computed predictions (one per row of the requestedset). When supplied, the internalpredict.modelblueprint()call is skipped. Use this in loops or dashboards where predictions have already been computed to avoid redundant scoring.
Examples
# \donttest{
mb <- modelblueprint(
model = glm(vs ~ wt + hp, data = mtcars, family = binomial),
train = mtcars,
y_name = "vs",
model_display_name = "logistic_vs"
)
gain(mb)
# }