model_revert: Revert back to a specific insuRglm model

View source: R/model_revert.R

model_revertR Documentation

Revert back to a specific insuRglm model

Description

Reverts back to a specific saved insuRglm model within the setup (modeling) object.

Usage

model_revert(setup, to)

Arguments

setup

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

to

Character scalar. Name of the saved model that we wish to revert to.

Value

Setup object with updated attributes.

See Also

model_save

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() %>%
  model_revert(to = 'model1') # from now on the two lines above have no effect (but they stay documented)


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