Skip to contents

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.

Usage

# S3 method for class 'rpf'
bundle(x, ...)

Arguments

x

An rpf object.

...

Unused.

Value

An object of class bundled_rpf for bundle(), or the restored rpf object for unbundle().

Examples

fit <- rpf(mpg ~ wt + cyl, data = mtcars, ntrees = 10)
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  21.1
#>  2  19.4
#>  3  23.8
#>  4  20.1
#>  5  17.5
#>  6  18.5
#>  7  14.7
#>  8  23.5
#>  9  22.5
#> 10  19.4
#> # ℹ 22 more rows