Session Ready
Exercise

Predictions of a single model

To calculate the performance of a classification model you need to compare the actual values of Attrition to those predicted by the model. When calculating metrics for binary classification tasks (such as precision and recall), the actual and predicted vectors must be converted to binary values.

In this exercise, you will learn how to prepare these vectors using the model and validate dataframes from the first cross-validation fold as an example.

Instructions
100 XP
  • Extract the model and the validate dataframe from the first fold of the cross-validation.
  • Extract the Attrition column from the validate dataframe and convert the values to binary (TRUE/FALSE).
  • Use model to predict the probabilities of attrition for the validate dataframe.
  • Convert the predicted probabilities to a binary vector, assume all probabilities greater than 0.5 are TRUE.