Extras - Model deployment

Advanced tidymodels

Deploy your model

Deploying a model

We have a decision tree, tree_fit, to model whether or not a plot of land in Washington is forested or not.

How do we use our model in production?

library(vetiver)
v <- vetiver_model(tree_fit, "forested")
v
#> 
#> ── forested ─ <bundled_workflow> model for deployment 
#> A rpart classification modeling workflow using 18 features

Learn more at https://vetiver.rstudio.com

Deploy your model

How do we use our model in production?

library(plumber)
pr() %>%
  vetiver_api(v)
#> # Plumber router with 4 endpoints, 4 filters, and 1 sub-router.
#> # Use `pr_run()` on this object to start the API.
#> ├──[queryString]
#> ├──[body]
#> ├──[cookieParser]
#> ├──[sharedSecret]
#> ├──/logo
#> │  │ # Plumber static router serving from directory: /Users/simoncouch/Library/R/arm64/4.4/library/vetiver
#> ├──/metadata (GET)
#> ├──/ping (GET)
#> ├──/predict (POST)
#> └──/prototype (GET)

Learn more at https://vetiver.rstudio.com

Your turn

Run the vetiver chunk in your .qmd.

Check out the automated visual documentation.

05:00