Aan de slagGa gratis aan de slag

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_numdata, the logistic regression lr_model, the user-defined class-evaluate() function, and the trainand test splits have already been loaded for you.

Deze oefening maakt deel uit van de cursus

Feature Engineering in R

Cursus bekijken

Oefeninstructies

  • Add a polynomial transformation to all numeric predictors.
  • Fit workflow to the train data.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

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)
Code bewerken en uitvoeren