| model_fit | R Documentation |
Fits the model with the current model formula. Computes and saves back many new attributes and objects.
This is a required step before using model_visualize, model_compare, model_save,
model_betas, model_crossval, model_lift, model_export and others.
In case of a big dataset (especially many columns), declaring future::plan(multiprocess) beforehand
might help to speed up the process.
model_fit(setup, glm_backend = c("setup", "speedglm", "stats"))
setup |
Setup object. Created at the start of the workflow. Usually piped in from previous step. |
glm_backend |
Character scalar. Either 'setup', 'speedglm' or 'stats'. Choosing 'setup', which is a default
choice results in using the |
Setup object with updated attributes.
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')
)
# parallel processing is supported and may be faster on bigger datasets
plan(multiprocess)
modeling <- setup %>%
factor_add(pol_yr) %>%
factor_add(agecat) %>%
model_fit()
modeling %>%
model_visualize(factors = 'fitted')
modeling %>%
model_visualize(factors = 'unfitted')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.