UC San Diego
COGS 137 - Fall 2026
2026-11-04
tidymodelsDue Dates:
Note: hw02 graded; feedback posted as Issue on GH
tidymodels
tidymodels: philosophy“Other packages, such as caret and mlr, help to solve the R model API issue. These packages do a lot of other things too: pre-processing, model tuning, resampling, feature selection, ensembling, and so on. In the tidyverse, we strive to make our packages modular and parsnip is designed only to solve the interface issue. It is not designed to be a drop-in replacement for caret. The tidymodels package collection, which includes parsnip, has other packages for many of these tasks, and they are designed to work together. We are working towards higher-level APIs that can replicate and extend what the current model packages can do.” - Max Kuhn (
tidymodelsdeveloper)
Benefits:
tidymodels: ecosystemThe main packages (and their roles):
In intro stats, you should have learned the central dogma of statistics: we sample from a population

The data from the sample are used to make an inference about the population:

tidymodelsNot part of tidyverse; load separately
… using formula syntax
\[\widehat{outcome}_{i} = \beta_0 + \beta_1 \times predictor_{i}\] . . .
🧠 How do we read/interpret this model?
\[\widehat{outcome}_{i} = \beta_0 + \beta_1 \times predictor_{i}\]
For prediction, we have a similar sampling problem:

But now we are trying to build a rule that can be used to predict a single observation’s value of some characteristic using characteristics of the other observations.

The goal is to:
build a machine learning algorithm
that uses features as input
and predicts an outcome variable
in the situation where we do not know the outcome variable.
🧠 Summarize/Evaluate: How is this similar/different from inference?
Typically, you use data where you have both the input and output data to train a machine learning algorithm.
What you need:
tidymodels for MLHow these packages fit together for carrying out machine learning:
tidymodels: stepstidymodels