Skip to content

ahmedlubis/HR_Attrition_Analysis_Using_Random_Forest

Repository files navigation

Based on the provided report, here is the detailed breakdown of the hr_data description and the interpretation of the Random Forest model's results.

  1. Description of hr_data dataset The dataset initially contained 14,999 rows and 10 columns. After dropping rows with missing values (drop_na()) to ensure model stability, the clean dataset contains 14,430 rows. The 10 variables in the dataset include:
  • left (Target Variable): Categorized into two factors: "Stayed" (0) or "Left" (1).
  • satisfaction_level: Numeric score representing employee job satisfaction.
  • last_evaluation: Numeric performance evaluation score.
  • number_project: The number of projects the employee has worked on.
  • average_montly_hours: Average monthly hours worked by the employee.
  • time_spend_company: Number of years spent at the company.
  • Work_accident: Factor indicating if the employee had a workplace accident.
  • promotion_last_5years: Factor indicating if the employee was promoted recently.
  • department: Categorical variable denoting the employee's business unit (e.g., sales).
  • salary: Categorical variable representing pay level, ordered as "low", "medium", or "high".
  1. Interpretation of Results Model PerformanceThe Random Forest model was trained using an ensemble of 500 decision trees on a 70% stratified training split (10,102 samples).
  • Out-of-Bag (OOB) Error Rate: The internal training validation yielded a remarkably low 1% error rate.
  • Overall Accuracy: When evaluated against the unseen 30% testing set (4,328 samples) , the model achieved 98.75% accuracy , massively outperforming the No Information Rate of 79.21%.
  • Sensitivity & Specificity:
  • Sensitivity (Recall for "Stayed"): 99.82% – The model is exceptionally good at correctly identifying employees who will stay.
  • Specificity (Recall for "Left"): 94.67% – The model is highly competent at capturing actual attrition cases, flagging nearly 95% of employees who genuinely left.

Feature Importance (Key Drivers of Attrition) The model ranks feature significance using two primary metrics: Mean Decrease Accuracy (how much predictive accuracy is lost if the variable is removed) and Mean Decrease Gini (how pure the node splits are when using this variable).

  • Primary Driver — Job Satisfaction: satisfaction_level is by far the single most influential predictor of employee attrition. It has the highest Mean Decrease Accuracy (215.97) and Gini score (1124.48).
  • Secondary Drivers — Workload and Tenure:
  • number_project (Gini: 581.12)
  • time_spend_company (Gini: 593.85)
  • average_montly_hours (Gini: 484.80)
  • last_evaluation (Gini: 419.98) This indicates that employee retention is heavily tied to operational workload metrics (hours, evaluation, projects) and organizational tenure.

Negligible Drivers: Environmental and structural traits like Work_accident, promotion_last_5years, department, and salary have very little impact on the model's capacity to predict turnover compared to everyday satisfaction and workload.

About

Random_Forest

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages