Skip to content

The main objective is to predict the behavior of customers who will be churn in the next month in order to retain those customers by analyze all relevant customer data and develop focused customer retention programs.

Notifications You must be signed in to change notification settings

manuelcalcada/Telco-Customer-Churn

Repository files navigation

Telco Customer Churn

image

Objective

To predict the behavior of customers who will be churn in the next month in order to retain those customers by analyze all relevant customer data and develop focused customer retention programs.

Used data

  • Each row represents a customer.
  • Each column contains customer’s attributes.
  • The data set includes information about:
    • Customers who left within the last month – the column is called Churn
    • Services that each customer has signed up for – phone, multiple lines, internet, online security, online backup, device protection, tech support, and streaming TV and movies
    • Customer account information – how long they’ve been a customer, contract, payment method, paperless billing, monthly charges, and total charges
    • Demographic info about customers – gender, age range, and if they have partners and dependents
  • The used dataset was obtained in https://www.kaggle.com/blastchar/telco-customer-churn

Hypothesis

Some hypotheses were formulated to predict the behavior of customers who are likely to churn or not in the next month. These hypotheses were divided into three groups:

  1. Services information hypotheses
    • These hypotheses are related to the customer contacted products and services
  2. Customer information hypotheses
    • These hypotheses are related to the customer account information, like contract, payment method and charges
  3. Sociodemographic information hypotheses
    • These hypotheses are related to the customer sociodemographic information, like gender, age and so on

Hypotheses summary
Group # Hypothesis
Services
informations
H1 Customers with phone services are less likely to churn
H2 Customers with fewer phone lines are more likely to churn
H3 Customers with internet services are more likely to churn
H4 Customers with online security service are more likely to churn
H5 Customers with online backup service are more likely to churn
H6 Customers with device protection service are more likely to churn
H7 Customers with tech support service are more likely to churn
H8 Customers with TV streaming service are more likely to churn
H9 Customers with movie streaming service are more likely to churn
Customer
informations
H10 Customers with a longer relationship with the company are less likely to churn
H11 Customers monthly contract are more likely to churn
H12 Customers with paperless billing are more likely to churn
H13 Customers with automatic payment methods are less likely to churn
H14 Customers with less monthly expenses are less likely to churn
H15 Customers with less total expenses are less likely to churn
Sociodemographic
informations
H16 Female customers are less likely to churn
H17 Senior citizen customers are less likely to churn
H18 Customers with partners are more likely to churn
H19 Customers with dependents are more likely to churn

Methodology

The methodology used in the analysis of this case will be the CRISP-DM, through the following division of scripts (click to go to the notebook):

  1. Exploratory Data Analysis - Business and Data understanding
  2. Data pre-processing - Data preparation
  3. Statistical modeling of a churn propensity model - Modeling and Evaluation
  4. Statistical modeling of a regression model of the customer charge - Modeling and Evaluation
  5. Statistical modeling of a customer clustering model - Modeling and Evaluation

Exploratory Data Analysis main results

image

image

image

Insights from bivariate analysis

  • Customers with phone service seem to have a slightly greater propensity to churn than others
  • Customers with multiple phone lines seem to have a slightly greater propensity to churn than others
  • Customers with fiber optic internet service seem to have a greater propensity to churn than DSL customers. Also, customers with internet services seem to have a greater propensity to churn than others
  • Customers without online security, online backup, device protection, and tech support services seem to have a slightly greater propensity to churn than others
  • Customers without TV streaming and movies streaming seem to have a greater propensity to churn than other customers
  • Customers with less tenure seem to have a greater propensity to churn than others
  • Customers with lower monthly charges seem to have a lower propensity to churn than others
  • Month-to-month customers seem to have a greater propensity to churn than others
  • Paperless billing customers seem to have a greater propensity to churn than others
  • Customers with eletronic check payment method seem to have a greater propensity to churn than others
  • Customers with automatic payment method seem to have less propensity to churn than others
  • There are no significant differences between the two groups in the gender variable
  • Senior citizens seem to have a greater propensity to churn than others
  • Customers without partner seem to have a greater propensity to churn than others
  • Customers without dependents seem to have a greater propensity to churn than others

Churn propensity model

The following models was used:

  1. Logistic Regression
  2. K-Nearest Neighbors
  3. Decision Tree
  4. Gaussian Naive-Bayes
  5. Suport Vector Machine
  6. Gradient Boosting
  7. Extra Trees
  8. Ada Boost
  9. Stochastic gradient descent
  10. Random Forest
  11. XGBoost
  12. Multi Layer Perceptron Neural Network

The model training and evaluate followed the steps below:

  1. Scenery 1.1: Training all the models with the default hyperparameters in the original dataset
  2. Scenery 1.2: Training all the models with the default hyperparameters in the dataset with tenure as categorical
  3. Scenery 1.3: Training all the models with the default hyperparameters in the original dataset after PCA transformation
  4. Scenery 1.4: Training all the models with the default hyperparameters in the original dataset after SMOTE balancing
  5. Scenery 1.5: Training all the models with the default hyperparameters in the original dataset after undersampling balancing
  6. Scenery 1.6: Training all the models with the default hyperparameters in the original dataset after feature selection
  7. Scenery 2.1: Training all the models with the default hyperparameters using the best three founded scenarios
  8. Hyperparameter optimization of the best models found in the best scenario
  9. Creation of voting classifiers with these best models
  10. Definition of the chosen model

The models evaluation focus mainly in:

  1. F1-Score (test partition)
  2. Precision (test partition)
  3. Cross validation accuracy (in train partition)
  4. Stability (in cross validation train and the whole sample train)
  5. Accuracy (test partition)

Best model and scenario results

Confusion matrix

image

Feature importance

image

So, for this model, the most important feature was the tenure. The higher the tenure, the lower the churn propensity. This is inline with the EDA insights and the hypothesis.

Decile analysis

image

According to the lift, the first two deciles are highly important to be encouraged by a marketing campaign in order to stay in the company and not go into churn. The third and fourth deciles also have a higher churn average than the total base average, so they should also be reached by a marketing campaign.

Charge regression model

The following models was used:

  1. Linear regression (OLS)
  2. Logistic Regression
  3. K-Nearest Neighbors
  4. Decision Tree
  5. Gaussian Naive-Bayes
  6. Suport Vector Machine
  7. Gradient Boosting
  8. Extra Trees
  9. Ada Boost
  10. Stochastic gradient descent
  11. Random Forest
  12. XGBoost
  13. Multi Layer Perceptron Neural Network

The model training and evaluate followed the steps below:

  1. Training all the models with the default hyperparameters in the original dataset
  2. Hyperparameter optimization of the best models found (if needed)
  3. Creation of voting regressors with these best models (if needed)
  4. Definition of the chosen model

The models evaluation focus mainly in:

  1. R2-score (test partition)
  2. MAE (test partition)
  3. MSE (test partition)

Best model and scenario results

The best model was a linear regression.

In this experiment, a regression model was created to predict the monthly charge paid by the customer. This model is useful to be used with the churn propensity model, in the final table of propensity, where it can be compared if the value of the customer prone to churn is outdated (greater) than that of customers who are not prone.

In this way, we were also able to understand the impact on cost that each service purchased has, as well as their combination in bundle.

Customer clustering model

Using an elbow method, the KN clustering founds 4 clusters to the customers.

image

From these analysis:

Cluster 0:

  • The customers are younger than clusters 1 and 3
  • Has more phone services than internet services
  • Has usually one phone line
  • Customers with approximately 3 years of tenure
  • Has a low term contract (monthly)
  • Uses an electronic check payment method
  • Uses as much fiber optic internet as DSL internet
  • Spends an average of 62 dollars per month

Cluster 1:

  • Higher percentage of senior citizens than other clusters
  • Higher percentage of married people with dependents
  • Higher tenure (more than 5 years)
  • Has all the internet and phone services
  • Has multiple phone lines
  • Uses a fiber optic internet
  • Higher monthly charges than others clusters
  • Spends an average of 100 dollars per month
  • Has paperless billing
  • High use of TV and movie streaming
  • Has a long term contract (2 years)
  • Uses an automatic payment method
  • Less propensity to churn

Cluster 2:

  • Younger customers
  • Has more phone services than internet services
  • Has one phone line
  • Customers with less than 1 year of tenure
  • Has a low term contract (monthly)
  • Uses an electronic check and mailed check payment method
  • Uses as much fiber optic internet as DSL internet
  • Spends an average of 48 dollars per month
  • High propensity to churn

Cluster 3:

  • Has more internet services than phone services
  • Has more than one phone line
  • Customers with 4 years of tenure
  • Has a mid term contract (1 year)
  • Uses an electronic check payment method
  • Uses a fiber optic internet
  • Spends an average of 82 dollars per month

Visit my LinkedIn!

About

The main objective is to predict the behavior of customers who will be churn in the next month in order to retain those customers by analyze all relevant customer data and develop focused customer retention programs.

Topics

Resources

Stars

Watchers

Forks