View source: R/pin-read-write.R
vetiver_pin_write | R Documentation |
Use vetiver_pin_write()
to pin a trained model to a board of models,
along with an input prototype for new data and other model metadata. Use
vetiver_pin_read()
to retrieve that pinned object.
vetiver_pin_write(board, vetiver_model, ..., check_renv = FALSE)
vetiver_pin_read(board, name, version = NULL, check_renv = FALSE)
board |
A pin board, created by |
vetiver_model |
A deployable |
... |
Additional arguments passed on to methods for a specific board. |
check_renv |
Use renv to record the
packages used at training time with |
name |
Pin name. |
version |
Retrieve a specific version of a pin. Use |
These functions read and write a vetiver_model()
pin on the
specified board
containing the model object itself and other elements
needed for prediction, such as the model's input data prototype or which
packages are needed at prediction time. You may use pins::pin_read()
or
pins::pin_meta()
to handle the pin, but vetiver_pin_read()
returns a
vetiver_model()
object ready for deployment.
vetiver_pin_read()
returns a vetiver_model()
; vetiver_pin_write()
returns the name of the new pin, invisibly.
library(pins)
model_board <- board_temp()
cars_lm <- lm(mpg ~ ., data = mtcars)
v <- vetiver_model(cars_lm, "cars_linear")
vetiver_pin_write(model_board, v)
model_board
vetiver_pin_read(model_board, "cars_linear")
# can use `version` argument to read a specific version:
pin_versions(model_board, "cars_linear")
# can store an renv lockfile as part of the pin:
vetiver_pin_write(model_board, v, check_renv = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.