CommencerCommencer gratuitement

Employee churn study

Acquiring new employees as replacements incurs hiring costs and training costs. You want to predict how long current employees will stay. This exercise focuses on the first steps to prepare to make predictions.

You have a DataFrame called employees. It contains data about 1470 employees (churned and present) and how their survey answers. The survey is across the following dimensions:

  • environment_satisfaction
  • job_satisfaction
  • relationship_satisfaction
  • work_life_balance

Additionally, years_at_company means the duration employees have worked and attrition indicates if the employee has churned (1 if churn, 0 otherwise).

Sample rows are printed for you in the console. The CoxPHFitter class is imported for you from the lifelines package.

Cet exercice fait partie du cours

Survival Analysis in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Instantiate a CoxPHFitter object cph
cph = ____()

# Fit cph on all covariates
cph.____(____)
Modifier et exécuter le code