1 - Introduction

Introduction to tidymodels

Welcome!

Wi-Fi network name

TODO-ADD-LATER

Wi-Fi password

TODO-ADD-LATER

Workshop policies

Who are you?

  • You can use the magrittr %>% or base R |> pipe

  • You are familiar with functions from dplyr, tidyr, ggplot2

  • You have exposure to basic statistical concepts

  • You do not need intermediate or expert familiarity with modeling or ML

Who are tidymodels?

  • Simon Couch
  • Hannah Frick
  • Emil Hvitfeldt
  • Max Kuhn

Many thanks to Davis Vaughan, Julia Silge, David Robinson, Julie Jung, Alison Hill, and DesirΓ©e De Leon for their role in creating these materials!

πŸ‘€

Plan for this workshop

  • Your data budget
  • What makes a model
  • Evaluating models
  • Tuning models

Introduce yourself to your neighbors πŸ‘‹



Log in to Posit Cloud (free): TODO-ADD-LATER

What is machine learning?

What is machine learning?

What is machine learning?

Your turn

How are statistics and machine learning related?

How are they similar? Different?

03:00

What is tidymodels?

library(tidymodels)
#> ── Attaching packages ──────────────────────────── tidymodels 1.2.0 ──
#> βœ” broom        1.0.5      βœ” rsample      1.2.1 
#> βœ” dials        1.2.1      βœ” tibble       3.2.1 
#> βœ” dplyr        1.1.4      βœ” tidyr        1.3.1 
#> βœ” infer        1.0.7      βœ” tune         1.2.1 
#> βœ” modeldata    1.3.0      βœ” workflows    1.1.4 
#> βœ” parsnip      1.2.1      βœ” workflowsets 1.1.0 
#> βœ” purrr        1.0.2      βœ” yardstick    1.3.1 
#> βœ” recipes      1.0.10
#> ── Conflicts ─────────────────────────────── tidymodels_conflicts() ──
#> βœ– purrr::discard() masks scales::discard()
#> βœ– dplyr::filter()  masks stats::filter()
#> βœ– dplyr::lag()     masks stats::lag()
#> βœ– recipes::step()  masks stats::step()
#> β€’ Use tidymodels_prefer() to resolve common conflicts.

The whole game

  • Roadmap for today
  • Minimal version of predictive modeling process
  • Feature engineering and tuning as iterative extensions

The whole game

The whole game

The whole game

The whole game

The whole game

The whole game

The whole game

Let’s install some packages

If you are using your own laptop instead of Posit Cloud:

# Install the packages for the workshop
pkgs <- 
  c("bonsai", "doParallel", "embed", "finetune", "lightgbm", "lme4",
    "plumber", "probably", "ranger", "rpart", "rpart.plot", "rules",
    "splines2", "stacks", "text2vec", "textrecipes", "tidymodels", 
    "vetiver", "remotes")

install.packages(pkgs)



Our versions

R version 4.3.3 (2024-02-29), Quarto (1.5.30)

package version
bonsai 0.2.1
broom 1.0.5
dials 1.2.1
doParallel 1.0.17
dplyr 1.1.4
embed 1.1.4
finetune 1.2.0
ggplot2 3.5.0
lightgbm 4.3.0
package version
lme4 1.1-35.3
modeldata 1.3.0
parsnip 1.2.1
plumber 1.2.2
probably 1.0.3
purrr 1.0.2
ranger 0.16.0
recipes 1.0.10
remotes 2.5.0
package version
rpart 4.1.23
rpart.plot 3.1.2
rsample 1.2.1
rules 1.0.2
scales 1.3.0
splines2 0.5.1
stacks 1.0.4
text2vec 0.6.4
textrecipes 1.0.6
package version
tibble 3.2.1
tidymodels 1.2.0
tidyr 1.3.1
tune 1.2.1
vetiver 0.2.5
workflows 1.1.4
workflowsets 1.1.0
yardstick 1.3.1