1. Learn
  2. /
  3. Courses
  4. /
  5. HR Analytics: Predicting Employee Churn in Python

Connected

Exercise

Comparison of Employee attrition models

In this exercise, your task is to compare the balanced and imbalanced (default) models using the pruned tree (max_depth=7). The imbalanced model is already done using recall and ROC/AUC scores. Complete the same steps for the balanced model.

  • The variables features_train, target_train, features_test and target_test are already available in your workspace.
  • An imbalanced model has already been fit for you and, and its predictions saved as prediction.
  • The functions recall_score() and roc_auc_score() have been imported for you.

Instructions

100 XP
  • Initialize the balanced model, setting its maximum depth to 7, and its seed to 42.
  • Fit it to the training component using the training set.
  • Make predictions using the testing set.
  • Print the recall score and ROC/AUC score.