MLOps with vetiver in Python and R: Answering your questions

[This article was first published on RStudio | Open source & professional software for data science teams on RStudio, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

As a follow-up to last month’s MLOps with vetiver in Python and R webinar, we’d like to highlight and answer some of the great audience questions asked during the session. You can also check out the demo and slides on the webinar’s website.

Questions from attendees fell into four main categories:

Trying out vetiver

Are the performance metrics customizable? Performance metrics are customizable. Customizing metrics in R requires you to make a custom yardstick metric. Customizing metrics in Python requires you to make a function with a y_pred and y_true argument for the values predicted by the model and true values, respectively.

Are all models supported by vetiver? R supports tidymodels workflows (including stacks), caret, mlr3, XGBoost, ranger, GAMS fit with mgcv, lm(), and glm(). Python supports scikit-learn, PyTorch, xgboost, and statsmodels, but also has the option to deploy any model with user-defined custom handlers.

Is vetiver for Python as complete as R? We have put together a list of function parity for R and Python as a comprehensive overview of the operational parity between R and Python. In general, these two packages have nearly identical implementations. However, we prioritize that the libraries feel idiomatic for the language and serve their community as needed.

How to use APIs for machine learning

JSON and APIs can be foreign to those new to model deployment or those with no web development experience. Do you have any advice or resources to share? It can be daunting to enter the world of APIs. Luckily, there are great resources to help you get started! Twitter accounts like @RapidAPI offer cartoons and bite-sized explanations of how APIs work. Appsilon also has a great article, “How to Make REST APIs with R: A Beginners Guide to Plumber.”

What is an API? Is there an RStudio product that includes APIs? An API, or Application Programming Interface, is a standardized way for machines to communicate with each other. RStudio Connect is able to host APIs.


Any way to deploy without RSConnect? You can use Docker as a portable way to transport vetiver to a public or private cloud. Vetiver will write basic Dockerfiles for you using vetiver_write_docker() in R or vetiver.write_docker() in Python.

Can you pass custom docker images that fit your organization’s security, architecture, etc.? The Dockerfiles generated by vetiver are well suited to basic deployments, but you are able to edit them to fit your organization’s needs.

Will this work within a GitHub Action workflow? Yes, you can schedule tasks through GitHub Actions with vetiver! You can use vetiver Dockerfiles, plumber.R files, or files just as you would normally in GitHub Actions.

Does vetiver integrate with mlflow? While there are no explicit integrations, these tools are especially made to be flexible and composable, so you can certainly use vetiver alongside mlflow. One way to use these tools together would be to use mlflow for experiment tracking, then put your finalized model into a vetiver API for deployment.

Vetiver and RStudio Connect

Do you need to make a Dockerfile if you’re deploying to RSConnect? Using vetiver_deploy_rsconnect() in R or vetiver.deploy_rsconnect() in Python will allow you to deploy your model directly to Connect, no Dockerfile needed!

Is there a RSConnect demo where I can see vetiver? For folks interested in seeing what data artifacts look like on Connect, check out these links:

You can also see the Python endpoint used in the demo.

There were so many great questions on API usage, connecting vetiver with other applications, and extending deployment workflows. Thank you for listening to the webinar and reading through this Q&A; you can use the RStudio Community link if you have other questions about vetiver.

To leave a comment for the author, please follow the link and comment on their blog: RStudio | Open source & professional software for data science teams on RStudio. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)