{"id":13704399,"url":"https://rstudio.github.io/vetiver-r/","last_synced_at":"2025-05-05T09:33:45.500Z","repository":{"id":37503698,"uuid":"384312833","full_name":"rstudio/vetiver-r","owner":"rstudio","description":"Version, share, deploy, and monitor models","archived":false,"fork":false,"pushed_at":"2024-10-09T17:09:00.000Z","size":10409,"stargazers_count":183,"open_issues_count":25,"forks_count":27,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-10T21:12:28.186Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rstudio.github.io/vetiver-r/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstudio.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-09T03:41:56.000Z","updated_at":"2024-11-05T17:35:41.000Z","dependencies_parsed_at":"2024-11-10T21:12:01.333Z","dependency_job_id":null,"html_url":"https://github.com/rstudio/vetiver-r","commit_stats":{"total_commits":373,"total_committers":11,"mean_commits":33.90909090909091,"dds":0.04289544235924936,"last_synced_commit":"5d3fd53d91148f8115a3b3d56339f9ae765a991d"},"previous_names":["tidymodels/vetiver"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fvetiver-r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fvetiver-r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fvetiver-r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fvetiver-r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstudio","download_url":"https://codeload.github.com/rstudio/vetiver-r/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224439940,"owners_count":17311553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T21:01:08.833Z","updated_at":"2024-11-13T11:31:20.441Z","avatar_url":"https://github.com/rstudio.png","language":"R","funding_links":[],"categories":["Tools","Packages"],"sub_categories":["Interpretability/Explicability","Machine learning"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# vetiver \u003ca href=\"https://rstudio.github.io/vetiver-r/\"\u003e\u003cimg src=\"man/figures/logo.png\" align=\"right\" height=\"138\" alt=\"vetiver website\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n[![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)\n[![CRAN status](https://www.r-pkg.org/badges/version/vetiver)](https://CRAN.R-project.org/package=vetiver)\n[![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)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n\u003c!-- badges: end --\u003e\n\n\u003e _Vetiver, the oil of tranquility, is used as a stabilizing ingredient in perfumery to preserve more volatile fragrances._\n\nThe 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:\n\n- the documentation at \u003chttps://vetiver.rstudio.com/\u003e\n- the Python package at \u003chttps://rstudio.github.io/vetiver-python/\u003e\n\nYou can use vetiver with:\n\n- a [tidymodels](https://www.tidymodels.org/) workflow (including [stacks](https://stacks.tidymodels.org/))\n- [caret](https://topepo.github.io/caret/)\n- [mlr3](https://mlr3.mlr-org.com/)\n- [XGBoost](https://xgboost.readthedocs.io/en/latest/R-package/)\n- [ranger](https://cran.r-project.org/package=ranger)\n- [`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)\n- GAMS fit with [mgcv](https://CRAN.R-project.org/package=mgcv)\n- [keras](https://tensorflow.rstudio.com/)\n- [the luz API for torch](https://torch.mlverse.org/)\n\n## Installation\n\nYou can install the released version of vetiver from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\ninstall.packages(\"vetiver\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"pak\")\npak::pak(\"rstudio/vetiver-r\")\n```\n\n## Example\n\nA `vetiver_model()` object collects the information needed to store, version, and deploy a trained model. \n\n```{r}\nlibrary(parsnip)\nlibrary(workflows)\ndata(Sacramento, package = \"modeldata\")\n\nrf_spec \u003c- rand_forest(mode = \"regression\")\nrf_form \u003c- price ~ type + sqft + beds + baths\n\nrf_fit \u003c- \n    workflow(rf_form, rf_spec) %\u003e%\n    fit(Sacramento)\n\nlibrary(vetiver)\nv \u003c- vetiver_model(rf_fit, \"sacramento_rf\")\nv\n```\n\nYou 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.\n\n```{r message=FALSE}\nlibrary(pins)\nmodel_board \u003c- board_temp()\nmodel_board %\u003e% vetiver_pin_write(v)\n```\n\nYou 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).\n\n\n```{r, eval=FALSE}\nlibrary(plumber)\npr() %\u003e%\n  vetiver_api(v) %\u003e%\n  pr_run(port = 8088)\n```\n\nIf 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:\n\n```{r}\nlibrary(vetiver)\nendpoint \u003c- vetiver_endpoint(\"http://127.0.0.1:8088/predict\")\nendpoint\n```\n\nSuch a model API endpoint deployed with vetiver will return predictions for appropriate new data.\n\n``` r\nlibrary(tidyverse)\nnew_sac \u003c- Sacramento %\u003e% \n    slice_sample(n = 20) %\u003e% \n    select(type, sqft, beds, baths)\n\npredict(endpoint, new_sac)\n#\u003e # A tibble: 20 x 1\n#\u003e      .pred\n#\u003e      \u003cdbl\u003e\n#\u003e  1 165042.\n#\u003e  2 212461.\n#\u003e  3 119008.\n#\u003e  4 201752.\n#\u003e  5 223096.\n#\u003e  6 115696.\n#\u003e  7 191262.\n#\u003e  8 211706.\n#\u003e  9 259336.\n#\u003e 10 206826.\n#\u003e 11 234952.\n#\u003e 12 221993.\n#\u003e 13 204983.\n#\u003e 14 548052.\n#\u003e 15 151186.\n#\u003e 16 299365.\n#\u003e 17 213439.\n#\u003e 18 287993.\n#\u003e 19 272017.\n#\u003e 20 226629.\n```\n\n\n\n## Contributing\n\nThis 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.\n\n- For questions and discussions about modeling, machine learning, and MLOps please [post on RStudio Community](https://community.rstudio.com/new-topic?category_id=15\u0026tags=vetiver,question).\n\n- If you think you have encountered a bug, please [submit an issue](https://github.com/rstudio/vetiver-r/issues).\n\n- 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.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/rstudio.github.io%2Fvetiver-r%2F","html_url":"https://awesome.ecosyste.ms/projects/rstudio.github.io%2Fvetiver-r%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/rstudio.github.io%2Fvetiver-r%2F/lists"}