Tidymodels packages

Installation and use

  • Install many of the packages in the tidymodels ecosystem by running install.packages("tidymodels").

  • Run library(tidymodels) to load the core packages and make them available in your current R session.

tidymodels

tidymodels is a meta-package that installs and load the core packages listed below that you need for modeling and machine learning.

rsample

rsample provides infrastructure for efficient data splitting and resampling.

parsnip

parsnip is a tidy, unified interface to models that can be used to try a range of models without getting bogged down in the syntactical minutiae of the underlying packages.

recipes

recipes is a tidy interface to data pre-processing tools for feature engineering.

workflows

workflows bundle your pre-processing, modeling, and post-processing together.

tune

tune helps you optimize the hyperparameters of your model and pre-processing steps.

yardstick

yardstick measures the effectiveness of models using performance metrics.

broom

broom converts the information in common statistical R objects into user-friendly, predictable formats.

dials

dials creates and manages tuning parameters and parameter grids.

Learn more about the tidymodels metapackage itself at https://tidymodels.tidymodels.org/.

Specialized packages

The tidymodels framework also includes many other packages designed for specialized data analysis and modeling tasks. They are not loaded automatically with library(tidymodels), so you’ll need to load each one with its own call to library(). These packages include:

Perform statistical analysis

  • infer is a high-level API for tidyverse-friendly statistical inference.

  • The corrr package has tidy interfaces for working with correlation matrices.

Create robust models

  • The spatialsample package provides resampling functions and classes like rsample, but specialized for spatial data.

  • parsnip also has additional packages that contain more model definitions. discrim contains definitions for discriminant analysis models, poissonreg provides definitions for Poisson regression models, plsmod enables linear projection models, and rules does the same for rule-based classification and regression models. baguette creates ensemble models via bagging, and multilevelmod provides support for multilevel models (otherwise known as mixed models or hierarchical models).

  • There are several add-on packages for creating recipes. embed contains steps to create embeddings or projections of predictors. textrecipes has extra steps for text processing, and themis can help alleviate class imbalance using sampling methods.

  • tidypredict and modeldb can convert prediction equations to different languages (e.g. SQL) and fit some models in-database.

Tune, compare, and work with your models

  • To try out multiple different workflows (i.e. bundles of pre-processor and model) at once, workflowsets lets you create sets of workflow objects for tuning and resampling.

  • To integrate predictions from many models, the stacks package provides tools for stacked ensemble modeling.

  • The finetune package extends the tune package with more approaches such as racing and simulated annealing.

  • The usemodels package creates templates and automatically generates code to fit and tune models.

  • probably has tools for post-processing class probability estimates.

  • The tidyposterior package enables users to make formal statistical comparisons between models using resampling and Bayesian methods.

  • Some R objects become inconveniently large when saved to disk. The butcher package can reduce the size of those objects by removing the sub-components.

  • To know whether the data that you are predicting are extrapolations from the training set, applicable can produce metrics that measure extrapolation.

  • shinymodels lets you explore tuning or resampling results via a Shiny app.

Develop custom modeling tools

  • hardhat is a developer-focused package that helps beginners create high-quality R packages for modeling.
Resources
Explore searchable tables of all tidymodels packages and functions.
Study up on statistics and modeling with our comprehensive books.
Hear the latest about tidymodels packages at the tidyverse blog.