Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

HR Analytics: Predicting Employee Churn in Python

Cursus bekijken

Oefeninstructies

  • 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.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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, ____)
Code bewerken en uitvoeren