switch_model: Switch Model from Grid in Nano Object

View source: R/switch_model.R

switch_modelR Documentation

Switch Model from Grid in Nano Object

Description

Switches a model with another model in its associated grid.

Usage

switch_model(
  nano,
  model_id,
  model_no,
  varimp_eval = FALSE,
  pdp_eval = FALSE,
  ice_eval = FALSE,
  interaction_eval = FALSE,
  plot = FALSE
)

Arguments

nano

nano objected created by create_nano().

model_id

model_id of the new model to be switched to

model_no

position in the list of models of the model to be replaced.

varimp_eval

calculate variable importance for the new model.

pdp_eval

calculate partial dependencies for the new model. If TRUE, then will calculate the partial dependencies for each of the variables the partial dependencies were calculated for the original model. If the original model did not have any partial dependencies, then partial dependencies will be calculated for each variable.

interaction_eval

calculates the interactions for the new model. Follows same logic as pdp_eval.

Details

Switches a model in a nano object with another model in its associated grid. By default, when a new grid is produced, the model with the best metric (chosen by the user) is set as the associated model for that grid. Hence, the user may call this function to select a different model from the built grid instead. The model_no is the position in the list of models of the model to be replaced. The model_id is the model_id of the new model which is to replace the original model. The new model must exist in the associated grid of the original model.

Value

a nano object with the original model replaced by the new model specified by the model_id.

Examples

## Not run: 
if(interactive()){
 # switches the second model in the list nano$model with the model with model_id "grid_2_model_3"
 nano <- switch_model(nano, 2, "grid_2_model_3")
 }

## End(Not run)

Nanoputian628/nano documentation built on Oct. 30, 2023, 3:28 p.m.