The Business Problem: Employee burnout is a critical issue that reduces productivity, increases turnover, and negatively impacts organizational health. To address this, I built a predictive machine learning model to help Human Resources proactively identify high-risk employees before burnout leads to attrition.
Exploratory Data Analysis
Understanding the distribution of our workforce data was crucial. Below are visualizations showcasing key demographic and workplace features, as well as the target variable: the Burnout Rate.
Examining the correlation between numerical features revealed a strong positive correlation between Mental Fatigue Score, Resource Allocation, and the Burnout Rate.
Data Preprocessing Pipeline
Real-world HR data is messy. There were missing values in the Mental Fatigue Score and Resource Allocation columns. I engineered a robust ColumnTransformer pipeline to handle missing values dynamically and apply standard scaling to numeric features while one-hot encoding categorical features.
# Build preprocessing pipeline
# - Numeric pipeline: median impute (for Resource Allocation, Mental Fatigue Score, tenure if needed) + StandardScaler
# - Categorical pipeline: OneHotEncoder (handle_unknown='ignore')
numeric_transformer = Pipeline(steps=[
('imputer', SimpleImputer(strategy='median')), # fills remaining numeric NaNs (should be none for test but safe)
('scaler', StandardScaler())
])
categorical_transformer = Pipeline(steps=[
('imputer', SimpleImputer(strategy='constant', fill_value='Unknown')), # if any unexpected missing
('onehot', OneHotEncoder(handle_unknown='ignore', sparse_output=False)) # Corrected parameter
])
preprocessor = ColumnTransformer(
transformers=[
('num', numeric_transformer, numeric_cols),
('cat', categorical_transformer, categorical_cols)
],
remainder='drop' # drop any other columns
)Model Training & Interpretation
I experimented with several models, ultimately selecting a Gradient Boosting Regressor which yielded the highest accuracy. The metrics across multiple evaluated models are shown below.
To make the model actionable for HR, I used SHAP (SHapley Additive exPlanations) to interpret feature importance, ensuring transparency in predictions.
Actionable Insight
The SHAP analysis clearly demonstrates that high Mental Fatigue Score combined with high Resource Allocation (workload) drastically increases burnout risk. HR can use these insights to target interventions, such as mandatory time-off or workload redistribution.
Deployment
The model is deployed as an interactive web application built with Streamlit. HR managers can input specific employee metrics into the dashboard and receive instant risk assessments and personalized explainability reports.
You can access the full source code and local installation instructions on GitHub, or view the live application directly via the links at the top of this walkthrough.