a set of practices to deploy and maintain machine learning models in production reliably and efficiently
MLOps with vetiver
Vetiver, the oil of tranquility, is used as a stabilizing ingredient in perfumery to preserve more volatile fragrances.
MLOps with vetiver
library(vetiver)v <-vetiver_model(housing_wf, "home-prices")v#> #> ββ home-prices β <bundled_workflow> model for deployment #> A ranger regression modeling workflow using 4 features
Make it easy to do the right thing
Robust and human-friendly checking of new data
Track and document software dependencies of models
Model cards for transparent, responsible reporting
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: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/vetiver#> βββ/metadata (GET)#> βββ/ping (GET)#> βββ/predict (POST)#> βββ/prototype (GET)## next pipe to `pr_run()` for local API
Where does vetiver work?
Positβs pro products, like Connect: vetiver_deploy_rsconnect()
AWS SageMaker: vetiver_deploy_sagemaker()
A public or private cloud, using Docker: vetiver_prepare_docker()
new_metrics <-augment(v, housing_val) |>vetiver_compute_metrics(date, "week", price, .pred)vetiver_pin_metrics( board, new_metrics,"julia.silge/housing-metrics",overwrite =TRUE)#> # A tibble: 90 Γ 5#> .index .n .metric .estimator .estimate#> <dttm> <int> <chr> <chr> <dbl>#> 1 2014-11-02 00:00:00 224 rmse standard 206519. #> 2 2014-11-02 00:00:00 224 rsq standard 0.414#> 3 2014-11-02 00:00:00 224 mae standard 139904. #> 4 2014-11-06 00:00:00 373 rmse standard 222259. #> 5 2014-11-06 00:00:00 373 rsq standard 0.555#> 6 2014-11-06 00:00:00 373 mae standard 150022. #> 7 2014-11-13 00:00:00 427 rmse standard 253473. #> 8 2014-11-13 00:00:00 427 rsq standard 0.562#> 9 2014-11-13 00:00:00 427 mae standard 145938. #> 10 2014-11-20 00:00:00 376 rmse standard 251856. #> # βΉ 80 more rows
Monitor your model
new_metrics |>## you can operate on your metrics as needed:filter(.metric %in%c("rmse", "mae"), .n >20) |>vetiver_plot_metrics() +## you can also operate on the ggplot:scale_size(range =c(2, 5))