Building a TidyModels classification model from scratch and deploying with Vetiver

[This article was first published on R Blogs – Hutsons-hacks, 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.

The awesome TidyModels team have been working hard to populate the tidymodels package and make it even easier to get your foot in the door when it comes to development of models in R.

I have been planning this workshop for a long time with my good old colleagues at the NHS-R Community, and we thought it apt to do this workshop in the run up to the awesome NHS-R Conference 2022, which sadly I cannot make this year due to work commitments.

What did the workshop cover?

In the workshop we went over many concepts relating to machine learning, with the focus being on:

  • Load in data from the MLDataR library
  • Explaratory data analysis
  • Create a recipe for model training
  • Build a Parsnip baseline regression model and then compare to a cutting edge algorithm (XGBoost)
  • Hyperparameter tune with dials and fit seperate models
  • Evaluate your model with ConfusionTableR
  • Visualise and save your model results
  • Serialise model
  • Build inference script to pass production data through model
  • Deploy your model with Vetiver (a new package for MLOps) which creates a Plumber API and docs for deploying to other services, such as a Dockerfile

This was structured as a code along workshop and it was interesting dealing and fault fixing issues on the spot.

Can I follow along with the workshop?

The workshop can be followed along below:

This contains the full two hour tutorial and active workshop ran on behalf of the NHS-R Community.

Where can I get the code?

The code can be obtained by accessing the supporting GitHub, please make sure you give it a star:

Closing thoughts

I really enjoyed this interactive session and it has had good to have an opportunity to feedback. This session has already attracted interest from the TidyModels team at R-Studio (now Posit) and from members of the group:

To leave a comment for the author, please follow the link and comment on their blog: R Blogs – Hutsons-hacks. 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)