LoslegenKostenlos loslegen

step_percentile()

How would applying a percentile transformation to your numeric variables affect model performance? Try it!

The attrition_numdata, the logistic regression lr_model, the user-defined class-evaluate() function, and the trainand test splits have already been loaded for you.

Diese Übung ist Teil des Kurses

Feature Engineering in R

Kurs anzeigen

Anleitung zur Übung

  • Apply a percentile transformation to all numeric predictors.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Add percentile tansformation to all numeric predictors
lr_recipe_perc <- 
  recipe(Attrition ~., data = train) %>%
  ___
lr_workflow_perc <-
  workflow() %>%
  add_model(lr_model) %>%
  add_recipe(lr_recipe_perc)
lr_fit_perc <- lr_workflow_perc %>% fit(train)
lr_aug_perc <- lr_fit_perc %>% augment(test)
lr_aug_perc %>% class_evaluate(truth = Attrition,
                 estimate = .pred_class,.pred_No)
Code bearbeiten und ausführen