vetiver

Version, share, deploy, and monitor models

https://github.com/rstudio/vetiver-r

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 12 committers (16.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.6%) to scientific vocabulary

Keywords from Contributors

tidy-data tidyverse setup shiny
Last synced: 10 months ago · JSON representation

Repository

Version, share, deploy, and monitor models

Basic Info
Statistics
  • Stars: 192
  • Watchers: 5
  • Forks: 29
  • Open Issues: 26
  • Releases: 15
Created about 5 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Changelog Contributing License Code of conduct

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# vetiver vetiver website


[![R-CMD-check](https://github.com/rstudio/vetiver-r/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rstudio/vetiver-r/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/vetiver)](https://CRAN.R-project.org/package=vetiver)
[![Codecov test coverage](https://codecov.io/gh/rstudio/vetiver-r/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rstudio/vetiver-r?branch=main)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#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:

- the documentation at 
- the Python package at 

You can use vetiver with:

- a [tidymodels](https://www.tidymodels.org/) workflow (including [stacks](https://stacks.tidymodels.org/))
- [caret](https://topepo.github.io/caret/)
- [mlr3](https://mlr3.mlr-org.com/)
- [XGBoost](https://xgboost.readthedocs.io/en/latest/R-package/)
- [ranger](https://cran.r-project.org/package=ranger)
- [`lm()`](https://stat.ethz.ch/R-manual/R-patched/library/stats/html/lm.html) and [`glm()`](https://stat.ethz.ch/R-manual/R-patched/library/stats/html/glm.html)
- GAMS fit with [mgcv](https://CRAN.R-project.org/package=mgcv)
- [keras](https://tensorflow.rstudio.com/)
- [the luz API for torch](https://torch.mlverse.org/)

## Installation

You can install the released version of vetiver from [CRAN](https://CRAN.R-project.org) with:

``` r
install.packages("vetiver")
```

And the development version from [GitHub](https://github.com/) with:

``` r
# 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. 

```{r}
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
```

You can **version** and **share** your `vetiver_model()` by choosing a [pins](https://pins.rstudio.com) "board" for it, including a local folder, Posit Connect, Amazon S3, and more.

```{r message=FALSE}
library(pins)
model_board <- board_temp()
model_board %>% vetiver_pin_write(v)
```

You can **deploy** your pinned `vetiver_model()` via a [Plumber API](https://www.rplumber.io/), which can be [hosted in a variety of ways](https://www.rplumber.io/articles/hosting.html).


```{r, eval=FALSE}
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](https://docs.posit.co/ide/user/ide/guide/tools/jobs.html)), you can make predictions with that deployed model and new data in another, separate R process. First, create a model endpoint:

```{r}
library(vetiver)
endpoint <- vetiver_endpoint("http://127.0.0.1:8088/predict")
endpoint
```

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

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

predict(endpoint, new_sac)
#> # A tibble: 20 x 1
#>      .pred
#>      
#>  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](https://www.contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). 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](https://community.rstudio.com/new-topic?category_id=15&tags=vetiver,question).

- If you think you have encountered a bug, please [submit an issue](https://github.com/rstudio/vetiver-r/issues).

- Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example), to clearly communicate about your code.

Owner

  • Name: RStudio
  • Login: rstudio
  • Kind: organization
  • Email: info@rstudio.org
  • Location: Boston, MA

GitHub Events

Total
  • Issues event: 2
  • Watch event: 10
  • Issue comment event: 1
  • Fork event: 2
Last Year
  • Issues event: 2
  • Watch event: 10
  • Issue comment event: 1
  • Fork event: 2

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 389
  • Total Committers: 12
  • Avg Commits per committer: 32.417
  • Development Distribution Score (DDS): 0.049
Past Year
  • Commits: 5
  • Committers: 3
  • Avg Commits per committer: 1.667
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
Julia Silge j****e@g****m 370
Barret Schloerke s****e@g****m 6
Marc Becker 3****c 2
Amin Adibi a****i@a****a 2
Mervin Fansler m****r@b****k 2
olivroy 5****y 1
Tomasz Kalinowski t****z@r****m 1
Larefly d****s@h****m 1
Josiah Parry j****y@g****m 1
Galén 1****t 1
Daniel Falbel d****l@g****m 1
Colin Gillespie c****e@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 113
  • Total pull requests: 83
  • Average time to close issues: 2 months
  • Average time to close pull requests: 15 days
  • Total issue authors: 53
  • Total pull request authors: 14
  • Average comments per issue: 2.91
  • Average comments per pull request: 1.48
  • Merged pull requests: 73
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 6
  • Pull requests: 2
  • Average time to close issues: 16 days
  • Average time to close pull requests: about 3 hours
  • Issue authors: 6
  • Pull request authors: 2
  • Average comments per issue: 1.83
  • Average comments per pull request: 0.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • juliasilge (39)
  • F041 (4)
  • tyluRp (3)
  • DyfanJones (3)
  • EmilHvitfeldt (3)
  • JosiahParry (3)
  • aminadibi (3)
  • Olummy (2)
  • HanselPalencia (2)
  • csgillespie (2)
  • joscani (2)
  • ncullen93 (2)
  • aephidayatuloh (2)
  • sebsilas (2)
  • miguellacerda (2)
Pull Request Authors
  • juliasilge (65)
  • mfansler (3)
  • dfalbel (3)
  • bjfletcher (2)
  • aminadibi (2)
  • olivroy (2)
  • DyfanJones (1)
  • cregouby (1)
  • be-marc (1)
  • galen-ft (1)
  • csgillespie (1)
  • t-kalinowski (1)
  • kevinushey (1)
Top Labels
Issue Labels
feature (33) documentation (4) discussion 🗣 (1) bug (1) upkeep (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • cran 25,597 last-month
  • Total docker downloads: 21,643
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 7
    (may contain duplicates)
  • Total versions: 30
  • Total maintainers: 1
proxy.golang.org: github.com/rstudio/vetiver-r
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 11 months ago
cran.r-project.org: vetiver

Version, Share, Deploy, and Monitor Models

  • Versions: 15
  • Dependent Packages: 1
  • Dependent Repositories: 7
  • Downloads: 25,597 Last month
  • Docker Downloads: 21,643
Rankings
Stargazers count: 2.5%
Forks count: 3.1%
Dependent repos count: 11.1%
Average: 12.3%
Downloads: 14.3%
Dependent packages count: 18.1%
Docker downloads count: 24.9%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.4 depends
  • butcher * imports
  • cli * imports
  • fs * imports
  • generics * imports
  • glue * imports
  • hardhat * imports
  • httr * imports
  • jsonlite * imports
  • lifecycle * imports
  • magrittr >= 2.0.3 imports
  • pins >= 1.0.0 imports
  • plumber >= 1.0.0 imports
  • purrr * imports
  • rapidoc * imports
  • readr >= 1.4.0 imports
  • renv * imports
  • rlang >= 1.0.0 imports
  • tibble * imports
  • vctrs * imports
  • withr * imports
  • LiblineaR * suggests
  • callr * suggests
  • caret * suggests
  • covr * suggests
  • curl * suggests
  • dplyr * suggests
  • flexdashboard * suggests
  • ggplot2 * suggests
  • httpuv * suggests
  • knitr * suggests
  • mlr3 * suggests
  • mlr3data * suggests
  • mlr3learners * suggests
  • modeldata * suggests
  • parsnip * suggests
  • pingr * suggests
  • plotly * suggests
  • ranger * suggests
  • recipes * suggests
  • rmarkdown * suggests
  • rpart * suggests
  • rsconnect * suggests
  • slider >= 0.2.2 suggests
  • testthat >= 3.0.0 suggests
  • tidyselect * suggests
  • vdiffr * suggests
  • workflows * suggests
  • xgboost * suggests
  • yardstick * suggests
.github/workflows/R-CMD-check-hard.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action 4.1.4 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
inst/requirements/keras-requirements.txt pypi
  • keras *
  • tensorflow *
inst/requirements/luz-renviron.txt pypi
  • TORCH_HOME =
  • TORCH_INSTALL =1