vetiver_pin_write: Read and write a trained model to a board of models

Description Usage Arguments Details Value Examples

View source: R/pin-read-write.R

Description

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.

Usage

1
2
3

Arguments

board

A pin board, created by board_folder(), board_rsconnect(), board_url() or another board_ function.

vetiver_model

A deployable vetiver_model() object

name

Pin name.

version

Retrieve a specific version of a pin. Use pin_versions() to find out which versions are available and when they were created.

Details

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.

Value

vetiver_pin_read() returns a vetiver_model(); vetiver_pin_write() returns the name of the new pin, invisibly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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")

tidymodels/vetiver documentation built on Jan. 14, 2022, 7:32 p.m.