library(mleap)
library(sparklyr)
<- spark_connect(master = "local")
sc
<- copy_to(sc, mtcars, overwrite = TRUE)
mtcars_tbl
<- ml_pipeline(sc) %>%
pipeline ft_binarizer("hp", "big_hp", threshold = 100) %>%
ft_vector_assembler(c("big_hp", "wt", "qsec"), "features") %>%
ml_gbt_regressor(label_col = "mpg")
<- ml_fit(pipeline, mtcars_tbl)
pipeline_model
<- ml_transform(pipeline_model, mtcars_tbl)
preds
<- file.path(tempdir(), "mtcars_model.zip")
model_path
ml_write_bundle(
x = pipeline_model,
transformed_dataset = preds,
path = model_path,
overwrite = TRUE
)
Export a Spark pipeline for serving
R/write-bundle.R
ml_write_to_bundle_transformed
Description
This functions serializes a Spark pipeline model into an MLeap bundle.
Usage
ml_write_to_bundle_transformed(x, transformed_dataset, path, overwrite = FALSE)
Arguments
Arguments | Description |
---|---|
x | A Spark ML Pipeline Model object. |
transformed_dataset | A Spark data frame created by the ML Pipeline Model (x ) |
path | Where to save the bundle. |
overwrite | Whether to overwrite an existing file, defaults to FALSE . |