Skip to content
All projects

CESI · 5th year

Employee attrition prediction

A machine learning model that predicts employee departures from HR data, with an ethical analysis of sensitive variables.

CompletedFeb 2026
Employee attrition prediction

A fictitious company, HumanForYou, is losing part of its workforce. From the HR data of 4,410 employees, the project builds a model that predicts whether an employee will leave, and tries to understand why. Departures only account for about 16% of cases: the classes are imbalanced, so models were judged on F1 score and AUC rather than accuracy alone.

Approach

  1. 1Data preparation: merging five sources (general data, satisfaction surveys, manager reviews, clock-in and clock-out times), missing values, one-hot encoding and scaling. Average working time is computed from the clock-in data
  2. 2Exploratory analysis: distributions, correlations, box plots by group
  3. 3Seven algorithms compared on a stratified 70 / 30 split: logistic regression, perceptron, SVM, naive Bayes, decision tree, random forest and k-NN
  4. 4The random forest comes first (F1 of 0.944 and AUC of 0.995), ahead of the decision tree (F1 of 0.905); linear models, naive Bayes and k-NN stay under 0.41
  5. 5Bayesian optimisation of the random forest hyperparameters (scikit-optimize), with five-fold cross-validation
  6. 6Ethical analysis: gender and marital status can be removed from the model with no loss of performance, which limits the risk of discrimination and GDPR non-compliance
  7. 7Interpretation and HR recommendations based on feature importance: average working time comes first, ahead of age, total work experience and monthly income
ROC curves of the seven models
ROC curves of the seven models
The twenty most important features of the final model
The twenty most important features of the final model