Code for the tutorial:
AutoML in HR: Predict Employee Attrition with a Built-In Fairness Report
This project shows how to use AutoML to predict employee attrition and check model fairness for the Gender feature.
The main notebook is:
automl-HR.ipynb
It shows how to:
- load HR employee attrition data,
- define
Attritionas the target, - train models with AutoML,
- compare models on the leaderboard,
- inspect feature importance,
- check fairness metrics for Gender.
AutoML trained several models. The best selected model was:
3_Linear
The Linear model is useful because it has good performance and is easier to explain than many complex models.
The notebook checks fairness for the Gender feature.
The model has similar selection rates:
Male: 0.1196
Female: 0.1121
The Demographic Parity Ratio is:
0.9373
The model passed the fairness check with threshold 0.8.
git clone https://github.com/pplonski/automl-in-hr.git
cd automl-in-hr
python -m venv venv
source venv/bin/activate # macOS/Linux
# venv\Scripts\activate # Windows
pip install -U pip
pip install pandas mljar-supervised jupyter
jupyter notebook automl-HR.ipynbMachine learning in HR should be used carefully. The model can support HR analysis, but it should not make automatic decisions about employees.
MIT