View source: R/vetiver-model.R
vetiver_model | R Documentation |
A vetiver_model()
object collects the information needed to store, version,
and deploy a trained model. Once your vetiver_model()
object has been
created, you can:
store and version it as a pin with vetiver_pin_write()
create an API endpoint for it with vetiver_api()
vetiver_model(
model,
model_name,
...,
description = NULL,
metadata = list(),
save_prototype = TRUE,
save_ptype = deprecated(),
versioned = NULL
)
new_vetiver_model(
model,
model_name,
description,
metadata,
prototype,
versioned
)
model |
A trained model, such as an |
model_name |
Model name or ID. |
... |
Other method-specific arguments passed to |
description |
A detailed description of the model. If omitted, a brief description of the model will be generated. |
metadata |
A list containing additional metadata to store with the pin.
When retrieving the pin, this will be stored in the |
save_prototype |
Should an input data prototype be stored with the model?
The options are |
save_ptype |
|
versioned |
Should the model object be versioned when stored with
|
prototype |
An input data prototype. If |
You can provide your own data to save_prototype
to use as examples in the
visual documentation created by vetiver_api()
. If you do this,
consider checking that your input data prototype has the same structure
as your training data (perhaps with hardhat::scream()
) and/or simulating
data to avoid leaking PII via your deployed model.
Some models, like ranger::ranger()
, keras,
and luz (torch),
require that you pass in example training data as prototype_data
or else explicitly set save_prototype = FALSE
. For non-rectangular data
input to models, such as image input for a keras or torch model, we currently
recommend that you turn off prototype checking via save_prototype = FALSE
.
A new vetiver_model
object.
cars_lm <- lm(mpg ~ ., data = mtcars)
vetiver_model(cars_lm, "cars-linear")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.