model_lift | R Documentation |
Visualize the lift chart of one or all saved insuRglm models. The records are first ordered by predictions in ascending order and then divided roughly into several buckets (groups). Average of target variable is computed and displayed for each group separately.
model_lift( setup, data = c("train", "crossval"), model = c("current", "all"), buckets = 10, weighted = TRUE )
setup |
Setup object. Created at the start of the workflow. Usually piped in from previous step. |
data |
Character scalar. Either |
model |
Character scalar. Either |
buckets |
Integer scalar. Number of groups to divide data into. |
weighted |
Boolean scalar. Whether the average of target variable in each group should be weighted. |
List of one or more ggplo2 charts.
model_save
, model_crossval
require(dplyr) # for the pipe operator data('sev_train') setup <- setup( data_train = sev_train, target = 'sev', weight = 'numclaims', family = 'gamma', keep_cols = c('pol_nbr', 'exposure', 'premium') ) modeling <- setup %>% factor_add(pol_yr) %>% factor_add(agecat) %>% model_fit() modeling %>% model_lift(data = 'train', buckets = 10) modeling_cv <- modeling %>% model_crossval() modeling_cv %>% model_lift(data = 'crossval', buckets = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.