Exercise

Predict before they leave!

In this exercise, you will use the variables you just created to predict how long current employees will stay.

In the previous exercise, you fitted the data to a CoxPHFitter model object called cph. You also created the following variables to use for prediction:

  • current_employees: DataFrame for all employees that are still present.
  • current_employees_last_obs: Series referring to the durations column of DataFrame current_employees.

The model object cph you just fitted the data to, DataFrame current_employees, and Series current_employees_last_obs are loaded for you. Now you can use them to help the HR department with this prediction task!

Instructions 1/2

undefined XP
    1
    2
  • Use cph to predict the survival function for individuals in current_employees, given how long they have already worked for.