Skip to content

Axing a model_stack.

Remove the call.

Remove controls used for training.

Remove the training data.

Remove environments.

Remove fitted values.

Usage

# S3 method for model_stack
axe_call(x, verbose = FALSE, ...)

# S3 method for model_stack
axe_ctrl(x, verbose = FALSE, ...)

# S3 method for model_stack
axe_data(x, verbose = FALSE, ...)

# S3 method for model_stack
axe_env(x, verbose = FALSE, ...)

# S3 method for model_stack
axe_fitted(x, verbose = FALSE, ...)

Arguments

x

A model object

verbose

Print information each time an axe method is executed. Notes how much memory is released and what functions are disabled. Default is FALSE.

...

Additional arguments. Currently ignored.

Value

Axed model_stack object.

Examples


# build a regression model stack
st <-
  stacks() %>%
  add_candidates(reg_res_lr) %>%
  add_candidates(reg_res_sp) %>%
  blend_predictions() %>%
  fit_members()
  
# remove any of the "butcherable"
# elements individually
axe_call(st)
#> ── A stacked ensemble model ─────────────────────────────────────
#> 
#> Print methods for butchered model stacks are disabled.
axe_ctrl(st)
#> ── A stacked ensemble model ─────────────────────────────────────
#> 
#> Print methods for butchered model stacks are disabled.
axe_data(st)
#> ── A stacked ensemble model ─────────────────────────────────────
#> 
#> Print methods for butchered model stacks are disabled.
axe_fitted(st)
#> ── A stacked ensemble model ─────────────────────────────────────
#> 
#> Print methods for butchered model stacks are disabled.
axe_env(st)
#> ── A stacked ensemble model ─────────────────────────────────────
#> 
#> Print methods for butchered model stacks are disabled.

# or do it all at once!
butchered_st <- butcher(st, verbose = TRUE)
#>  Memory released: 155.86 kB
#>  Disabled: `print()` and `summary()`

format(object.size(st))
#> [1] "2465848 bytes"
format(object.size(butchered_st))
#> [1] "1565608 bytes"