Employee attrition is a crucial aspect of human resource management, influencing strategic workforce planning and retention efforts. This comprehensive documentation guides you through the process of analyzing employee attrition using a dataset. The project encompasses data preprocessing, exploratory data analysis (EDA), and the implementation of various machine learning models.
The dataset contains employee information for predicting attrition, including attributes like age, daily rate, department, and more.
Columns with over 80% empty values were dropped to streamline the dataset.
- Encoding Categorical Columns: Categorical columns were encoded using LabelEncoder.
- Normalizing Data: A Gaussian distribution was created for each attribute. Attributes with a standard deviation below 0.8 were excluded after normalization.
Explored the dataset to derive insights into employee characteristics and potential factors contributing to attrition.
Applied PCA for feature extraction and visualization.
Implemented the following models:
-
Mean-Shift: Utilizes Mean-Shift clustering for prediction. Achieves an accuracy of 86.17%.
-
K-Nearest Neighbors (KNN): Employs a KNN classifier with k=3. Achieves an accuracy of 78.68%.
-
Support Vector Machine (SVM): Implements an SVM classifier with a linear kernel. Achieves an accuracy of 86.17%.
-
K-Means: Applies K-Means clustering for prediction. Achieves accuracy metrics, precision, recall, and F1 score.
-
Decision Tree: Trains a Decision Tree classifier. Achieves an accuracy of 86.17%.
Explored through bar charts for feature comparison between different attributes to gain insights into employee attrition.
The Random Forest Classifier was employed to identify the top features contributing to employee attrition. Top 10 Features:
- 'OverTime'
- 'MonthlyIncome'
- 'TotalWorkingYears'
- 'Age'
- 'YearsAtCompany'
- 'StockOptionLevel'
- 'JobLevel'
- 'YearsWithCurrManager'
- 'MaritalStatus'
- 'JobRole'
Categorical columns are encoded using LabelEncoder for numerical analysis.
A heatmap of the correlation matrix visualizes relationships between features, aiding in identifying potential correlations influencing employee attrition.
Selected important features ('OverTime', 'MonthlyIncome', etc.) are analyzed in a filtered heatmap for deeper insights.