1. Learn
  2. /
  3. Courses
  4. /
  5. Modeling with tidymodels in R

Exercise

Removing correlated predictors with recipes

Removing correlated predictor variables from your training and test datasets is an important feature engineering step to ensure your model fitting runs as smoothly as possible.

Now that you have discovered that monthly_charges and avg_data_gb are highly correlated, you must add a correlation filter with step_corr() to your feature engineering pipeline for the telecommunications data.

In this exercise, you will create a recipe object that removes correlated predictors from the telecommunications data.

The telecom_training and telecom_test datasets have been loaded into your session.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Create a recipe object, telecom_cor_rec, that sets the outcome variable to canceled_service and all remaining columns in telecom_training to predictor variables.
  • Add a preprocessing step that removes highly correlated predictor variables using the all_numeric() selector function and a correlation threshold of 0.8.