Lab 4C

Directions: Follow along with the slides, completing the questions in blue on your computer, and answering the questions in red in your journal.

Space, Click, Right Arrow or swipe left to move to the next slide.

What is cross-validation?

Step 1: train-test split

train_rows <- sample(1:____, size = 85)
train <- slice(arm_span, ____)
test <- slice(____, - ____)

Aside: set.seed()

Whenever you split data into training and testing, always use set.seed first.

Aside: train-test ratio

Step 2: train the model

Step 3: test the model

test <- mutate(test, ____ = predict(best_train, newdata = ____))


Why cross-validate?

Example of overfitting

Example of overfitting, continued