• Stars
    star
    176
  • Rank 210,115 (Top 5 %)
  • Language
    R
  • License
    Other
  • Created almost 3 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Version, share, deploy, and monitor models

vetiver vetiver website

R-CMD-check CRAN status Codecov test coverage Lifecycle: experimental

Vetiver, the oil of tranquility, is used as a stabilizing ingredient in perfumery to preserve more volatile fragrances.

The goal of vetiver is to provide fluent tooling to version, share, deploy, and monitor a trained model. Functions handle both recording and checking the modelโ€™s input data prototype, and predicting from a remote API endpoint. The vetiver package is extensible, with generics that can support many kinds of models, and available for both R and Python. To learn more about vetiver, see:

You can use vetiver with:

Installation

You can install the released version of vetiver from CRAN with:

install.packages("vetiver")

And the development version from GitHub with:

# install.packages("pak")
pak::pak("rstudio/vetiver-r")

Example

A vetiver_model() object collects the information needed to store, version, and deploy a trained model.

library(parsnip)
library(workflows)
data(Sacramento, package = "modeldata")

rf_spec <- rand_forest(mode = "regression")
rf_form <- price ~ type + sqft + beds + baths

rf_fit <- 
    workflow(rf_form, rf_spec) %>%
    fit(Sacramento)

library(vetiver)
v <- vetiver_model(rf_fit, "sacramento_rf")
v
#> 
#> โ”€โ”€ sacramento_rf โ”€ <bundled_workflow> model for deployment 
#> A ranger regression modeling workflow using 4 features

You can version and share your vetiver_model() by choosing a pins โ€œboardโ€ for it, including a local folder, Posit Connect, Amazon S3, and more.

library(pins)
model_board <- board_temp()
model_board %>% vetiver_pin_write(v)

You can deploy your pinned vetiver_model() via a Plumber API, which can be hosted in a variety of ways.

library(plumber)
pr() %>%
  vetiver_api(v) %>%
  pr_run(port = 8088)

If the deployed model endpoint is running via one R process (either remotely on a server or locally, perhaps via a background job in the RStudio IDE), you can make predictions with that deployed model and new data in another, separate R process. First, create a model endpoint:

library(vetiver)
endpoint <- vetiver_endpoint("http://127.0.0.1:8088/predict")
endpoint
#> 
#> โ”€โ”€ A model API endpoint for prediction: 
#> http://127.0.0.1:8088/predict

Such a model API endpoint deployed with vetiver will return predictions for appropriate new data.

library(tidyverse)
new_sac <- Sacramento %>% 
    slice_sample(n = 20) %>% 
    select(type, sqft, beds, baths)

predict(endpoint, new_sac)
#> # A tibble: 20 x 1
#>      .pred
#>      <dbl>
#>  1 165042.
#>  2 212461.
#>  3 119008.
#>  4 201752.
#>  5 223096.
#>  6 115696.
#>  7 191262.
#>  8 211706.
#>  9 259336.
#> 10 206826.
#> 11 234952.
#> 12 221993.
#> 13 204983.
#> 14 548052.
#> 15 151186.
#> 16 299365.
#> 17 213439.
#> 18 287993.
#> 19 272017.
#> 20 226629.

Contributing

This project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

  • For questions and discussions about modeling, machine learning, and MLOps please post on RStudio Community.

  • If you think you have encountered a bug, please submit an issue.

  • Either way, learn how to create and share a reprex (a minimal, reproducible example), to clearly communicate about your code.

More Repositories

1

cheatsheets

Posit Cheat Sheets - Can also be found at https://posit.co/resources/cheatsheets/.
TeX
5,540
star
2

shiny

Easy interactive web applications with R
R
5,209
star
3

rstudio

RStudio is an integrated development environment (IDE) for R
Java
4,432
star
4

bookdown

Authoring Books and Technical Documents with R Markdown
JavaScript
3,613
star
5

rmarkdown

Dynamic Documents for R
R
2,737
star
6

shiny-examples

JavaScript
1,927
star
7

gt

Easily generate information-rich, publication-quality tables from R
R
1,914
star
8

blogdown

Create Blogs and Websites with R Markdown
R
1,694
star
9

reticulate

R Interface to Python
R
1,627
star
10

webinars

Code and slides for RStudio webinars
HTML
1,510
star
11

rticles

LaTeX Journal Article Templates for R Markdown
TeX
1,402
star
12

plumber

Turn your R code into a web API.
R
1,355
star
13

tensorflow

TensorFlow for R
R
1,321
star
14

renv

renv: Project environments for R.
R
953
star
15

pagedown

Paginate the HTML Output of R Markdown with CSS for Print
R
861
star
16

shinydashboard

Shiny Dashboarding framework
CSS
852
star
17

pointblank

Data quality assessment and metadata reporting for data frames and database tables
R
826
star
18

keras

R Interface to Keras
R
820
star
19

flexdashboard

Easy interactive dashboards for R
JavaScript
793
star
20

leaflet

R Interface to Leaflet Maps
JavaScript
784
star
21

rmarkdown-book

R Markdown: The Definitive Guide (published by Chapman & Hall/CRC in July 2018)
RMarkdown
738
star
22

ggvis

Interactive grammar of graphics for R
R
709
star
23

shiny-server

Host Shiny applications over the web.
JavaScript
700
star
24

rstudio-conf

Materials for rstudio::conf
HTML
696
star
25

learnr

Interactive Tutorials with R Markdown
R
695
star
26

RStartHere

A guide to some of the most useful R Packages that we know about
R
656
star
27

py-shiny

Shiny for Python
Python
627
star
28

DT

R Interface to the jQuery Plug-in DataTables
JavaScript
581
star
29

rmarkdown-cookbook

R Markdown Cookbook. A range of tips and tricks to make better use of R Markdown.
RMarkdown
562
star
30

blastula

Easily send great-looking HTML email messages from R
R
530
star
31

r2d3

R Interface to D3 Visualizations
R
513
star
32

bookdown-demo

A minimal book example using bookdown
CSS
476
star
33

hex-stickers

RStudio hex stickers
R
434
star
34

bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
SCSS
431
star
35

distill

Distill for R Markdown
HTML
418
star
36

packrat

Packrat is a dependency management system for R
R
394
star
37

tufte

Tufte Styles for R Markdown Documents
R
385
star
38

dygraphs

R interface to dygraphs
JavaScript
361
star
39

revealjs

R Markdown Format for reveal.js Presentations
JavaScript
316
star
40

pins-r

Pin, Discover and Share Resources
R
300
star
41

fontawesome

Easily insert FontAwesome icons into R Markdown docs and Shiny apps
R
289
star
42

profvis

Visualize R profiling data
JavaScript
285
star
43

crosstalk

Inter-htmlwidget communication for R (with and without Shiny)
JavaScript
285
star
44

config

config package for R
R
247
star
45

pool

Object Pooling in R
R
243
star
46

thematic

Theme ggplot2, lattice, and base graphics based on a few simple settings.
R
242
star
47

tinytex-releases

Windows/macOS/Linux binaries and installation methods of TinyTeX
PowerShell
242
star
48

Intro

Course materials for "Introduction to Data Science with R", a video course by RStudio and O'Reilly Media
R
234
star
49

shinytest

Automated testing for shiny apps
JavaScript
222
star
50

shinymeta

Record and expose Shiny app logic using metaprogramming
R
218
star
51

httpuv

HTTP and WebSocket server package for R
C
217
star
52

nomnoml

Sassy 'UML' Diagrams for R
JavaScript
217
star
53

shinyuieditor

A GUI for laying out a Shiny application that generates clean and human-readable UI code
JavaScript
206
star
54

htmltools

Tools for HTML generation and output
R
201
star
55

promises

A promise library for R
R
193
star
56

rstudioapi

Safely access RStudio's API (when available)
R
161
star
57

gradethis

Tools for teachers to use with learnr
R
159
star
58

concept-maps

Concept maps for all things data science
HTML
158
star
59

master-the-tidyverse

Course contents for Master the Tidyverse
156
star
60

shinythemes

Themes for Shiny
R
152
star
61

ShinyDeveloperConference

Materials collected from the First Shiny Developer Conference Palo Alto, CA January 30-31 2016
HTML
152
star
62

chromote

Chrome Remote Interface for R
R
148
star
63

shiny-gallery

Code and other documentation for apps in the Shiny Gallery โœจ
HTML
144
star
64

sortable

R htmlwidget for Sortable.js
R
124
star
65

reactlog

Shiny Reactivity Visualizer
JavaScript
121
star
66

rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
R
120
star
67

redx

dynamic nginx configuration
Lua
118
star
68

r-docker

Docker images for R
Dockerfile
117
star
69

bigdataclass

Two-day workshop that covers how to use R to interact databases and Spark
R
114
star
70

r-system-requirements

System requirements for R packages
Shell
111
star
71

shinyapps

Deploy Shiny applications to ShinyApps
110
star
72

webshot2

Take screenshots of web pages from R
R
109
star
73

shinyloadtest

Tools for load testing Shiny applications
HTML
108
star
74

shinyvalidate

Input validation package for the Shiny web framework
JavaScript
107
star
75

miniUI

R
102
star
76

sass

Sass compiler package for R
C++
102
star
77

shinytest2

R
100
star
78

keras-customer-churn

Customer Churn Shiny Application
R
98
star
79

r-builds

an opinionated environment for compiling R
Shell
91
star
80

r-manuals

A re-styled version of the R manuals
R
85
star
81

addinexamples

An R package showcasing how RStudio addins can be registered and used.
R
85
star
82

shinyapps-package-dependencies

Collection of bash scripts that install R package system dependencies
R
74
star
83

markdown

The first generation of Markdown rendering for R (born in 2012). Originally based on the C library sundown. Now based on commonmark. Note that this package is markdown, not *rmarkdown*.
R
72
star
84

R-Websockets

HTML 5 Websockets implementation for R
R
68
star
85

webdriver

WebDriver client in R
R
68
star
86

beyond-dashboard-fatigue

Materials for the RStudio webinar 'Beyond Dashboard Fatigue'
R
66
star
87

cloudml

R interface to Google Cloud Machine Learning Engine
R
65
star
88

shinylive

Run Shiny on Python (compiled to wasm) in the browser
TypeScript
61
star
89

rstudio-conf-2022-program

rstudio::conf(2022, "program")
R
61
star
90

rstudio-docker-products

Docker images for RStudio Professional Products
Shell
61
star
91

bookdown.org

Source documents to generate the bookdown.org website
R
59
star
92

education.rstudio.com

CSS
57
star
93

vetiver-python

Version, share, deploy, and monitor models.
Python
57
star
94

tfestimators

R interface to TensorFlow Estimators
R
57
star
95

connections

https://rstudio.github.io/connections/
R
54
star
96

tfprobability

R interface to TensorFlow Probability
R
54
star
97

sparkDemos

HTML
53
star
98

shiny-incubator

Examples and ideas that don't belong in the core Shiny package and aren't officially supported.
JavaScript
53
star
99

swagger

Swagger is a collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
HTML
51
star
100

leaflet.mapboxgl

Extends the R Leaflet package with a Mapbox GL JS plugin to allow easy drawing of vector tile layers.
R
49
star