Method for bundle::bundle() wrapping rpf_marshal()/rpf_unmarshal(),
so rpf models work with the standard tidymodels serialization workflow.
Training data is not included; see rpf_marshal() for the implications.
Pruned forests from prune_components() or rpf() are bundled the same way.
Arguments
- x
[rpf | rpf_pruned]: A fittedrpfmodel, or a pruned one fromprune_components().- ...
Unused.
Value
An object of class bundled_rpf (bundled_rpf_pruned) for bundle(),
or the restored rpf (rpf_pruned) object for unbundle().
Examples
fit <- rpf(mpg ~ wt + cyl, data = mtcars, n_families = 10, prune = FALSE)
b <- bundle::bundle(fit)
tmp <- tempfile(fileext = ".rds")
saveRDS(b, tmp)
restored <- bundle::unbundle(readRDS(tmp))
predict(restored, mtcars)
#> # A tibble: 32 × 1
#> .pred
#> <dbl>
#> 1 20.7
#> 2 20.6
#> 3 23.3
#> 4 20.2
#> 5 16.5
#> 6 18.2
#> 7 15.8
#> 8 23.7
#> 9 22.7
#> 10 18.6
#> # ℹ 22 more rows
unlink(tmp)