Final steps to nirvana

HR Analytics: Predicting Employee Churn in R

Anurag Gupta

People Analytics Practitioner

Build your final model

# Final model, you will complete this in the next exercise
final_log <- glm(...)
HR Analytics: Predicting Employee Churn in R

Predicting probability of turnover

# Make predictions for training dataset
prediction_train <- predict(final_log, newdata = train_set_final, 
                            type = "response")
prediction_train[c(205, 645)]
       205        645 
0.06069079 0.99999898
HR Analytics: Predicting Employee Churn in R

Plot probability range: training dataset

# Look at the predictions range
hist(prediction_train)

HR Analytics: Predicting Employee Churn in R

Predicting probability: testing dataset

# Make predictions for testing dataset
# test_set is the test dataset from chapter 3 exercise 2
prediction_test <- predict(final_log, newdata = test_set, 
                           type = "response")
HR Analytics: Predicting Employee Churn in R

Plot probability range: testing dataset

# Look at the predictions range
hist(prediction_test)

HR Analytics: Predicting Employee Churn in R

Let's practice!

HR Analytics: Predicting Employee Churn in R

Preparing Video For Download...