Making Predictions

Marketing Analytics: Predicting Customer Churn in Python

Mark Peterson

Director of Data Science, Infoblox

(Supervised) Machine Learning Primer

  • Goal: Predict whether or not a customer will churn
  • Target Variable: 'Churn'
  • Supervised Machine Learning
  • Learn from historical (training) data to make new predictions
Marketing Analytics: Predicting Customer Churn in Python

scikit-learn logo

Marketing Analytics: Predicting Customer Churn in Python

Model selection

  • Which model to use?
  • ... it depends!
  • In this course: Experiment with several models
  • To learn about their inner workings: Check out other DataCamp courses
Marketing Analytics: Predicting Customer Churn in Python

Model selection

  • Logistic regression: Good baseline
    • Offers simplicity and interpretability
    • Cannot capture more complex relationships
  • Random forests
  • Support vector machines
Marketing Analytics: Predicting Customer Churn in Python

Training your model

from sklearn.svm import SVC

svc = SVC()
svc.fit(telco[features], telco['target'])
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
  decision_function_shape='ovr', degree=3, gamma='scale', kernel='rbf',
  max_iter=-1, probability=False, random_state=None, shrinking=True,
  tol=0.001, verbose=False)
Marketing Analytics: Predicting Customer Churn in Python

Making a prediction

prediction = svc.predict(new_customer)

print(prediction)
[0]
Marketing Analytics: Predicting Customer Churn in Python

Let's practice!

Marketing Analytics: Predicting Customer Churn in Python

Preparing Video For Download...