Skip to content

nested_model_fit objects are created from the nestedmodels package, which allows parsnip models to be fitted on nested data. Axing a nested_model_fit object involves axing all the inner model_fit objects.

Usage

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

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

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

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

# S3 method for nested_model_fit
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.

...

Any additional arguments related to axing.

Value

Axed nested_model_fit object.

See also

Examples


library(nestedmodels)
library(parsnip)

model <- linear_reg() %>%
  set_engine("lm") %>%
  nested()

nested_data <- tidyr::nest(example_nested_data, data = -id)

fit <- fit(model, z ~ x + y + a + b, nested_data)

# Reduce the model size
butcher(fit)
#> Nested model fit, with 20 inner models
#> # A tibble: 20 × 2
#>       id .model_fit
#>    <int> <list>    
#>  1     1 <fit[+]>  
#>  2     2 <fit[+]>  
#>  3     3 <fit[+]>  
#>  4     4 <fit[+]>  
#>  5     5 <fit[+]>  
#>  6     6 <fit[+]>  
#>  7     7 <fit[+]>  
#>  8     8 <fit[+]>  
#>  9     9 <fit[+]>  
#> 10    10 <fit[+]>  
#> 11    11 <fit[+]>  
#> 12    12 <fit[+]>  
#> 13    13 <fit[+]>  
#> 14    14 <fit[+]>  
#> 15    15 <fit[+]>  
#> 16    16 <fit[+]>  
#> 17    17 <fit[+]>  
#> 18    18 <fit[+]>  
#> 19    19 <fit[+]>  
#> 20    20 <fit[+]>