Notes:
-
Problem Solved: Predicts likelihood of employee resignation using machine learning.
-
Customization Benefits: Retrain model on your own HR data.
-
Further Adoption: Embed in dashboards or retention tools.
Python Code:
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
df = pd.read_csv("employee_data.csv") # Includes 'left_company' (1=yes, 0=no)
features = df.drop(columns=['employee_id', 'left_company'])
target = df['left_company']
X_train, X_test, y_train, y_test = train_test_split(features, target, test_size=0.2, random_state=42)
model = RandomForestClassifier()
model.fit(X_train, y_train)
# Predict attrition
predictions = model.predict(X_test)
print("Prediction Sample:", predictions[:5])
No comments:
Post a Comment