HR Analytics:用 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 Analytics:用 R 预测员工流失