Get startedGet started for free

Who's staying?

It's time to practice combining several transformations to the attrition_num data. First, normalize or near-normalize numeric variables by applying a Yeo-Johnson transformation. Next, transform numeric predictors to percentiles, create dummy variables, and eliminate features with near zero variance.

This exercise is part of the course

Feature Engineering in R

View Course

Exercise instructions

  • Apply a Yeo-Johnson transformation to all numeric variables.
  • Transform all numeric predictors into percentiles.
  • Create dummy variables for all nominal predictors.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

lr_recipe <- recipe(Attrition ~., data = train) %>%

# Apply a Yeo-Johnson transformation to all numeric variables
  ___ %>%

# Transform all numeric predictors into percentiles
 ___ %>%

# Create dummy variables for all nominal predictors
  ___

lr_workflow <- workflow() %>% add_model(lr_model) %>% add_recipe(lr_recipe)
lr_fit <- lr_workflow %>% fit(train)
lr_aug <- lr_fit %>% augment(test)
lr_aug %>% class_evaluate(truth = Attrition, estimate = .pred_class,.pred_No)
Edit and Run Code