Wer bleibt?
Zeit, mehrere Transformationen auf die Daten attrition_num zu kombinieren. Normalisiere bzw. bringe zunächst numerische Variablen durch eine Yeo-Johnson-Transformation in eine (annähernd) Normalverteilung. Wandle anschließend numerische Prädiktoren in Perzentile um, erstelle Dummy-Variablen und entferne Features mit nahezu keiner Varianz.
Diese Übung ist Teil des Kurses
Feature Engineering in R
Anleitung zur Übung
- Wende eine Yeo-Johnson-Transformation auf alle numerischen Variablen an.
- Wandle alle numerischen Prädiktoren in Perzentile um.
- Erstelle Dummy-Variablen für alle nominalen Prädiktoren.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
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)