कर्मचारी Attrition मॉडलों की तुलना
इस अभ्यास में, आपका काम balanced और imbalanced (डिफ़ॉल्ट) मॉडलों की तुलना करना है, pruned ट्री (max_depth=7) का उपयोग करते हुए। imbalanced मॉडल पहले से recall और ROC/AUC स्कोरों के साथ पूरा किया जा चुका है। अब वही स्टेप्स balanced मॉडल के लिए पूरा कीजिए।
- वैरिएबल
features_train,target_train,features_testऔरtarget_testपहले से आपके वर्कस्पेस में उपलब्ध हैं. - आपके लिए एक imbalanced मॉडल पहले ही फिट किया गया है, और उसके प्रीडिक्शंस
predictionके रूप में सेव हैं. - फंक्शन
recall_score()औरroc_auc_score()आपके लिए इम्पोर्ट किए जा चुके हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
HR Analytics: Python में कर्मचारी churn की भविष्यवाणी
अभ्यास निर्देश
- balanced मॉडल को इनिशियलाइज़ करें, उसका maximum depth
7और seed42सेट करें. - उसे training सेट का उपयोग करके training कंपोनेंट पर फिट करें.
- testing सेट का उपयोग करके प्रीडिक्शन बनाइए.
- recall score और ROC/AUC स्कोर प्रिंट करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Print the recall score
print(recall_score(target_test,prediction))
# Print the ROC/AUC score
print(roc_auc_score(target_test,prediction))
# Initialize the model
model_depth_7_b =
# Fit it to the training component
model_depth_7_b.fit(____,____)
# Make prediction using test component
prediction_b =
# Print the recall score for the balanced model
print(____)
# Print the ROC/AUC score for the balanced model
print(____)