Using the logistic regression model

Introduction to Predictive Analytics in Python

Nele Verbiest, Ph.D

Data Scientist @PythonPredictions

The logistic regression function

0.545 * gender_F 
+ 0.021 * age 
-0.001 * time_since_last_gift 
-3.39
  • Female (gender_F=1)
  • age 72
  • 120 days since last gift
0.545 * 1 
+ 0.021 * 72 
-0.001 * 120 
-3.39 
= -1.45

$\frac{1}{1+e^{-(-1.45)}} = 0.19$

Introduction to Predictive Analytics in Python

Making predictions in Python

  • Female (gender_F=1)
  • Age 72
  • 120 days since last gift
logreg.predict_proba([1, 72, 120])
array([[ 0.8204144,  0.1795856]])
Introduction to Predictive Analytics in Python

Making predictions in Python

new_data = current_data[["gender_F","age","time_since_last_gift"]]

predictions = logreg.predict_proba(new_data)
Introduction to Predictive Analytics in Python

Let's practice!

Introduction to Predictive Analytics in Python

Preparing Video For Download...