Getting Started with tidymodels
Learn the fundamentals of tidymodels, recipes, and workflows.
We'll cover the following...
The tidymodels
package provides a consistent and unified framework for modeling and machine learning tasks, making it a very powerful resource. It’s part of the tidyverse ecosystem and is designed to work seamlessly with other tidyverse packages such as dplyr
, ggplot2
, and tidyr
.
Like the tidyverse, tidymodels
is based on tidy data and tidy modeling principles. In addition to the usual tidy data structure, when using tidymodels
, the modeling process is broken down into a series of steps, each clearly defined and repeatable. This modularity makes it easy to make changes—for example, swapping different modeling techniques.
Why use tidymodels
?
As with other functionality in the tidyverse, much of what can be done in tidymodels
is possible via other packages. For instance, some other packages enable training neural networks or carrying out linear regressions. However, for tidyverse users, tidymodels
is a natural next step due to its strong integration and consistency. We can prepare data for tidymodels
using standard tidyverse functionality and create visualizations via the usual ggplot2
commands.
Furthermore, in much the same way that the tidyverse gives consistency to our data-manipulation coding, tidymodels
provides a consistent syntax and interface for working with different modeling techniques, making it easier to learn and use compared to more traditional modeling frameworks. When we want to learn a new modeling technique, the learning is less about syntax and data organization and more about understanding the modeling technique itself. We can stay focused on the important parts of our models and worry less about code syntax!
While it’s worth noting that tidymodels
offers strong integration and consistency for working with different modeling techniques, there are cases where its flexibility may be limited compared to other modeling frameworks that are specifically tailored to advanced techniques. Highly specialized and cutting-edge modeling approaches are not always fully supported in tidymodels
. For instance, if we’re working on sophisticated time series analysis tasks that require state-space models or Bayesian structural time series, tidymodels
might not meet our needs with an out-of-the-box solution. In such cases, we may need to explore alternative frameworks that specialize specifically in the domain in question, for instance, Prophet. Nevertheless, for a wide range ...