Site icon R-bloggers

Reasons to Use Tidymodels

[This article was first published on Category R on Roel's R-tefacts, 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.

I was listening to episode 135 of ‘Not so standard deviations’ – Moderate confidence The hosts, Hilary and Roger talked about when to use tidymodels packages and when not. Here are my 2 cents for when I think it makes sense to use these packages and when not:

When not

  • you are always using GLM models. (they are very flexible!) it makes no sense to me to go for the extra {parsnip} layer if you are always using the same models. You could still consider using recipes to feature engineer.
  • If you are familiar with the kind of data and what models will work on that data. Basically you are an expert on this field and have worked on it for many years. There is no need to experiment.

When to use it

  • To make the steps very clear, when you work in a team, or when you have to come back to your code in a month, I really appreciate the clear verbs and consistent steps. I also think this readability is great for newcomers to R (maybe from another language)

  • experimenting with models to get a feel for the problem and solution space, I don’t know yet what model will work, so I try examples of different classes:decision trees, linear models, knn. To get a feel for the problem and solutions. (I’m sorry Roger, this does feel like kaggle)

  • modular approach to improving your machine learning pipelines, You often end up with one model that works well and develop feature engineering ({recipes}) next, tuning ({tune}) later. Trying out new models is so much better when the syntax/ arguments is clear!

  • turning exploration into production code. Ideally you cut out your working model code and deploy only that with some added logging to production (whatever that means to you). Here is where the plugability really shines. Maybe you don’t need the feature engineering? don’t use the recipes part, maybe your model hyper parameters fall within a certain range? make a small interval around that range. (with warnings when the hyperparameters fall outside of the known range?)

Right now, I’m a consultant, that means solving different problems with different data. When the tools remain the same but allow me to be very flexible I’m very happy! I feel the tools in tidymodels are like a car mechanic’s toolbox. For certain problems you grab a special tool, for others the basic ones, but they all work together. Most car mechanic tools work with the same pneumatic system and you can just swap out the tool while the framework remains the same.

image of mechanic tools

Notes

Question asked by @hspter and @rdpeng In episode 135 – moderate confidence.

Image of toolbox from unsplash by Nina Mercado

To leave a comment for the author, please follow the link and comment on their blog: Category R on Roel's R-tefacts.

R-bloggers.com 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.