R-Machine-Learning-Legacy
R-Machine-Learning-Legacy copied to clipboard
Solutions for 04_regularization
Solutions for 04_regularization should include:
Import data
penguins <- palmerpenguins::penguins %>% filter(!is.na(bill_length_mm))
Set seed
set.seed(23)
Perform split
penguin_split <- penguins %>% initial_split(prop = 0.80) penguins_train <- training(penguin_split) penguins_test <- testing(penguin_split)
Participants will run into error if null values in bill_length_mm are not dropped
If not filtered, this error will occur: "Error in if (nulldev == 0) stop("y is constant; gaussian glmnet fails at standardization step") : missing value where TRUE/FALSE needed"