Lab 4C
Directions: Follow along with the slides and answer the questions in red font in your journal.
y
-variable.heights
, we want see how well we predict the heights
of people that we haven’t yet measured.arm_span
data, fill in the blanks to create a training
and testing
data set.set.seed(123)
train_rows <- sample(1:____, size = 85)
train <- slice(arm_span, ____)
test <- slice(____, - ____)
train
and test
data sets.set.seed
.set.seed
, we’re able to reproduce the random splitting so that each person’s model outputs the same results.Whenever you split data into training and testing, always use set.seed
first.
training
data.best_train
.height
in our test
data.predict()
function we introduced in the last lab to make predictions.
test
data:height
for each value of armspan
.height
based on their armspan
really well for people already shown in our plot but would predict people not in our plot very poorly.