Calculating accuracy metrics: recall

The Recall score is another important metric used to measure the accuracy of a classification algorithm. It is calculated as the** fraction of True Positives over the sum of True Positives and False Negatives**, or $$\frac{\text{# of True Positives}}{\text{# of True Positives} + \text{# of False Negatives}}.$$

If there are no False Negatives, the recall score is equal to 1. If there are no True Positives, the recall score is equal to 0.

In this exercise, you will calculate the recall score (using the sklearn function recall_score) for your initial classification model.

The variables features_test and target_test are available in your workspace.

This exercise is part of the course

HR Analytics: Predicting Employee Churn in Python

View Course

Exercise instructions

  • Import the function to calculate the recall score.
  • Use the initial model to predict churn (based on features of the test set).
  • Calculate the recall score by comparing target_test with the predictions.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import the function to calculate recall score
from sklearn.____ import ____

# Use the initial model to predict churn
prediction = model.____(features_test)

# Calculate recall score by comparing target_test with the prediction
____(target_test, ____)