HR 分析:以 R 預測員工流失
Anurag Gupta
People Analytics Practitioner
# 最終模型,你會在下一個練習完成
final_log <- glm(...)
# 對訓練資料集做預測
prediction_train <- predict(final_log, newdata = train_set_final,
type = "response")
prediction_train[c(205, 645)]
205 645
0.06069079 0.99999898
# 查看預測值範圍
hist(prediction_train)

# 對測試資料集做預測
# test_set 是第 3 章練習 2 的測試資料集
prediction_test <- predict(final_log, newdata = test_set,
type = "response")
# 查看預測值範圍
hist(prediction_test)

HR 分析:以 R 預測員工流失