ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Feature Engineering in R

Ver curso

Instrucciones del ejercicio

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

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

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)
Editar y ejecutar código