step_poly()
Now that you have a baseline, you can compare your model's performance if you add a polynomial transformation to all numerical values.
The attrition_num
data, the logistic regression lr_model
, the user-defined class-evaluate()
function, and the train
and test
splits have already been loaded for you.
This exercise is part of the course
Feature Engineering in R
Exercise instructions
- Add a polynomial transformation to all numeric predictors.
- Fit workflow to the train data.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
lr_recipe_poly <-
recipe(Attrition ~., data = train) %>%
# Add a polynomial transformation to all numeric predictors
___
lr_workflow_poly <- workflow() %>%
add_model(lr_model) %>%
add_recipe(lr_recipe_poly)
# Fit workflow to the train data
lr_fit_poly <- ___ %>% fit(train)
lr_aug_poly <- lr_fit_poly %>% augment(test)
lr_aug_poly %>% class_evaluate(truth = Attrition, estimate = .pred_class,.pred_No)