Employee 이탈 예측 모델 비교
이 연습 문제에서는 가지치기한 트리(max_depth=7)를 사용해 balanced 모델과 imbalanced(기본값) 모델을 비교해 보겠습니다. imbalanced 모델에 대해서는 이미 recall과 ROC/AUC 점수를 계산해 두었습니다. 같은 절차를 balanced 모델에도 적용해 보세요.
features_train,target_train,features_test,target_test변수는 워크스페이스에 준비되어 있습니다.- imbalanced 모델은 이미 학습되었고 예측값은
prediction으로 저장되어 있습니다. recall_score()와roc_auc_score()함수는 미리 임포트되어 있습니다.
이 연습은 강의의 일부입니다
HR Analytics: Python으로 직원 이탈 예측하기
연습 안내
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# 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(____)