Sitemap

HR Study: Know Before They Quit

How to Detect Quitting Signals from Employee Data?

Press enter or click to view image in full size

People leave jobs. It happens every day and it is a natural part of working life. Yet sometimes a resignation hits harder than expected.

You lose someone,

  • talented,
  • who carried weight in the team,
  • and you invested in.

It makes you wonder if there were early signs. Could we have seen it coming?

What if data could whisper what words never said?

May be through a nice dashboard?

Press enter or click to view image in full size

Now, we will explore how employee engagement data might reveal the early signals of quiet quitting long before the goodbye message arrives, step by step.

I applied this analysis to several HR datasets, and it works well every time.

Let’s start!

Our dataset contains standard HR employee information. Let’s take a quick look at what’s inside.

STEP 1. Distribution of Attrition Status

This is the first important checkpoint.

Before any modeling, we need to look at our target variable, Attrition Status, to see if the data is balanced.

Press enter or click to view image in full size

In our dataset, we have records for 1,186 employees who are still working, and 284 employees who left.

That means our data is quite imbalanced, the “still working” group is much larger.

This is important. To make the model learn fairly from both sides, we can apply undersampling, which simply reduces the size of the majority class. This keeps a more balanced ratio between the two classes and helps the model learn patterns that lead to attrition more effectively.

undersampler = RandomUnderSampler(sampling_strategy=0.5, random_state=42)
X_train_resampled, y_train_resampled = undersampler.fit_resample(X_train,
y_train)

We could also use oversampling methods like SMOTE to create synthetic samples of employees who left.

We didn’t use it here, because oversampling can increase the risk of overfitting, especially when the minority class is small and the model starts memorizing patterns instead of learning them.

STEP 2. Building the Base Models:

Now that the data is ready, let’s build a set of base models to see which algorithm captures the attrition patterns best.

models = {
"Logistic Regression": LogisticRegression(class_weight="balanced",
penalty="l2", random_state=42),
"Decision Tree": DecisionTreeClassifier(class_weight="balanced",
max_depth=5, random_state=42),
"Random Forest": RandomForestClassifier(class_weight="balanced",
n_estimators=500, max_depth=3,
min_samples_split=100, min_samples_leaf=60,
random_state=42),
"XGBoost": XGBClassifier(use_label_encoder=False,
eval_metric="logloss", random_state=42, reg_lambda=1.0),
"LightGBM": LGBMClassifier(class_weight="balanced", random_state=42,
verbose=-1),
"CatBoost": CatBoostClassifier(verbose=0, random_state=42),
"Gradient Boosting": GradientBoostingClassifier(n_estimators=100,
learning_rate=0.1, random_state=42),
"AdaBoost": AdaBoostClassifier(n_estimators=100, random_state=42),
"SVM": SVC(class_weight="balanced", probability=True, random_state=42,
C=0.5),
"Naive Bayes": GaussianNB(),
"KNN": KNeighborsClassifier(n_neighbors=5)}

We trained several popular classification models. Here’s how they performed based on precision:

Model                  Precision
------------------------------------
| CatBoost | 0.8800 |
| Gradient Boosting | 0.8693 |
| SVM | 0.8371 |
| XGBoost | 0.7506 |
| LightGBM | 0.7200 |
| AdaBoost | 0.6720 |
| Logistic Regression | 0.6361 |
| KNN | 0.5200 |
| Decision Tree | 0.4969 |
| Random Forest | 0.4684 |
| Naive Bayes | 0.3960 |

CatBoost clearly stands out as the top performer in this setup, followed closely by Gradient Boosting and SVM.

The best model is not always the same.

This comparison is essential because different datasets carry different patterns. For example, while CatBoost worked best here, in another HR dataset XGBoost or SVM might capture the relationships more effectively.

Testing multiple models helps reveal which one truly understands your data.

STEP 3. Hyperparameter Tuning

After finding our best performing base model, we moved on to fine tuning its parameters to get the most out of it.

For CatBoost, we tested several combinations of depth, learning rate, iterations, and regularization values.

param_dist = {
"depth": [4, 6, 8, 10],
"learning_rate": [0.005, 0.01, 0.05, 0.1],
"iterations": [300, 500, 700, 1000],
"l2_leaf_reg": [1, 3, 5, 7]}
Best parameters: {'learning_rate': 0.1, 
'l2_leaf_reg': 7,
'iterations': 300,
'depth': 6}

As result:

Final Model Precision:
CatBoost: 0,89

After tuning, the CatBoost model achieved a precision of 0.89, showing a clear improvement compared to the base run.

Step 4. Understanding Feature Importance

This step matters the most.

If we want to understand why people leave, we need to look at the numbers behind the story.

Feature importance shows which factors influenced the model’s decisions the most. In other words, which variables played the biggest role in predicting attrition.

That means, it’s an analytical answer for:

“WHY PEOPLE ARE LEAVING”

Press enter or click to view image in full size

We can think of these as the key drivers of quitting behavior, each with a measurable impact.

For instance, salary appears to be nearly twice as important as total working years in predicting who might leave.

Get Deniz CANGÜVEN’s stories in your inbox

Join Medium for free to get updates from this writer.

That’s why you should give it twice the attention if you want to reduce employee turnover.

Note for HR Specialists:

Of course, this result may seem very obvious, but now the numbers let you compare them clearly. This is the point that every HR specialist should notice.

Now it’s time to analyze the Top 5 most important reasons. At this point, we move from data science to data analytics, from prediction to understanding.

STEP 6. Analyze Top 5 Reasons

Top 1st: Monthly income

Press enter or click to view image in full size

With a feature importance score of 9.44, monthly income stands out as the most critical factor influencing attrition.

As the chart shows, the attrition rate decreases as salary increases. Employees in the low salary group leave at a much higher rate, about 35%, compared to around 12% among higher salary groups.

Interestingly, within the upper-medium and high salary ranges, the effect of income becomes less visible. Once a fair pay level is reached, other factors start to play a bigger role than money.

HR To-Do:

  • Review salary ranges only for lower salaries and ensure they align with market standards.

Top 2nd: Number of Previous Employers

This means, “How many companies an employee worked before working in your company”.

Press enter or click to view image in full size
Press enter or click to view image in full size

As the number of previous employers increases, the likelihood of leaving also increases. Employees who have changed jobs frequently in the past are more likely to do so again.

There is one clear peak . Employees with 6 previous employers show a noticeably higher attrition rate.

HR To-Do:

  • Set a hiring rule to review candidates with more than 5 previous jobs more carefully. It looks like a strong parameter. 5 seems to be the limit.

Top 3rd: Job satisfaction

Press enter or click to view image in full size

The chart shows a clear pattern, as job satisfaction increases, attrition decreases.

Employees with the lowest satisfaction level are about three times more likely to leave compared to those who report the highest satisfaction.

This also means that employee surveys are effective.

HR To-Do:

  • Track job satisfaction scores regularly and follow up with employees showing low satisfaction levels. This is a major indicator.

Top 4th: Overtime Status

Around 25% of employees regularly work overtime.

Those who work overtime are 2.7 times more likely to leave compared to those who do not. Such a strong difference.

HR To-Do:

  • Review workload distribution to prevent chronic overtime patterns.
  • Discuss workload openly before overtime becomes a habit.
  • Promote a culture where staying late is not seen as commitment.
  • Support managers in planning realistic deadlines.

Top 5th: Distance From Home

Press enter or click to view image in full size

Most employees live close to the workplace. This shows that the company has a strong local workforce, which helps reduce travel stress and increase daily availability.

Press enter or click to view image in full size

This data shows a clear pattern. Employees who live more than 20 km away from the workplace have a much higher chance of leaving.

HR To-Do:

  • Explore flexible work options or hybrid schedules for employees living far from the office.
  • Consider transportation support or location-based incentives to improve retention.
  • Consider a 20 km distance limit for new hires to reduce future attrition risk.

STEP 7: Finally, Dasboard!

After all the analysis and modeling, it is time to see the results in action.

This dashboard brings everything together, showing the risk of leaving for each department and role.

Press enter or click to view image in full size

The visualization allows HR teams to see the risk by department, role, and individual. With this dashboard, predicting attrition is no longer just a theory but a practical decision support tool.

Final Thoughts

Data can help prevent people from leaving.

HR analytics helps leaders act early and create workplaces where people want to stay.

Every HR team should use a dashboard like this.

Keeping your best people means protecting your biggest investment.

“Keep the people, keep the power.”