Title: Recall
Slug: recall
Summary: How to evaluate a Python machine learning using recall.
Date: 2017-09-15 12:00
Category: Machine Learning
Tags: Model Evaluation Authors: Chris Albon

Recall is the proportion of every positive observation that is truly positive. Recall measures the model's ability to identify a observation of the positive class. Models with high recall are optimistic in that they have a low-bar for predicting that an observation in the positive class.

$$\displaystyle \mathrm {Recall}=\frac {TP}{TP + FN}$$

Preliminaries


In [1]:
# Load libraries
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_classification

Generate Features And Target Data


In [2]:
# Generate features matrix and target vector
X, y = make_classification(n_samples = 10000,
                           n_features = 3,
                           n_informative = 3,
                           n_redundant = 0,
                           n_classes = 2,
                           random_state = 1)

Create Logistic Regression


In [3]:
# Create logistic regression
logit = LogisticRegression()

Cross-Validate Model Using Recall


In [4]:
# Cross-validate model using precision
cross_val_score(logit, X, y, scoring="recall")


Out[4]:
array([ 0.95080984,  0.94961008,  0.95558223])