Churn prediction fundamentals

Machine Learning for Marketing in Python

Karolis Urbonas

Head of Analytics & Science, Amazon

What is churn?

  • Churn happens when a customer stops buying / engaging
  • The business context could be contractual or non-contractual
  • Sometimes churn can be viewed as either voluntary or involuntary
Machine Learning for Marketing in Python

Types of churn

Main churn typology is based on two business model types:

  • Contractual (phone subscription, TV streaming subscription)

Content

  • Non-contractual (grocery shopping, online shopping)

Grocery

Machine Learning for Marketing in Python

Modeling different types of churn

Typically:

  • Non-contractual churn is harder to define and model, as there's no explicit customer decision
  • We will model contractual churn in the telecom business model
Machine Learning for Marketing in Python

Encoding churn

  • Typically 1/0, with 1 = Churn, 0 = No Churn
  • Could be a string Churn/No Churn or Yes/No - best practice to transform as 1 and 0
    set(telcom['Churn'])
    
{0, 1}
Machine Learning for Marketing in Python

Exploring churn distribution

telcom.groupby(['Churn']).size() / telcom.shape[0] * 100
Churn
0    73.421502
1    26.578498
dtype: float64
Machine Learning for Marketing in Python

Split to training and testing data

from sklearn.model_selection import train_test_split
train, test = train_test_split(telcom, test_size = .25)
Machine Learning for Marketing in Python

Separate features and target variables

Separate column names by data types

target  = ['Churn']
custid  = ['customerID']
cols    = [col for col in telcom.columns if col not in custid + target]

Build training and testing datasets

train_X = train[cols]
train_Y = train[target]
test_X  = test[cols]
test_Y  = test[target]
Machine Learning for Marketing in Python

Let's go practice!

Machine Learning for Marketing in Python

Preparing Video For Download...