model_save: Save fitted insuRglm model for later use

View source: R/model_save.R

model_saveR Documentation

Save fitted insuRglm model for later use

Description

Saves already fitted insuRglm model for later use, which might be comparison using model_compare or returning back to a previous model using model_revert.

Usage

model_save(setup, name = NULL)

Arguments

setup

Setup object. Created at the start of the workflow. Usually piped in from previous step.

name

Character scalar. Model will be saved under this name.

Value

Setup object with updated attributes.

See Also

model_compare, model_revert

Examples

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() %>%
  model_save('model1') %>%
  factor_modify(agecat = variate(agecat, type = 'non_prop', mapping = c(1, 2, 3, 4, 5, 6))) %>%
  model_fit()

modeling %>%
  model_compare(with = 'model1')


realgabon/insuRglm documentation built on Jan. 2, 2023, 2:51 a.m.