在他們離職前先預測!
在這個練習中,你會使用剛建立的變數來預測目前員工還會待多久。
在前一個練習中,你已將資料擬合到名為 cph 的 CoxPHFitter 模型物件。你也建立了以下用於預測的變數:
current_employees:包含所有仍在職員工的 DataFrame。current_employees_last_obs:指向 DataFramecurrent_employees中 durations 欄位的 Series。
你剛擬合好的模型物件 cph、DataFrame current_employees,以及 Series current_employees_last_obs 都已載入。現在你可以用它們來協助人資部門完成這項預測任務!
本練習屬於課程
Python 的存活分析
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Predict survival function conditional on existing durations
____.predict_survival_function(____)