Predicting Customer Churn in the Telecommunications Industry
By: Leo Siu-Yin
Tags: Feature Selection, Logistic Regression, Random Forest, Data Science, Random Forest Classifiers

Predicting Customer Churn in the Telecommunications Industry

Image via Shutterstock under license to Leo Siu-Yin

Why Predict Customer Churn?

Getting new customers is much more expensive than retaining existing ones. Some studies have shown that it costs six to seven times more to acquire a new customer than to keep an existing one.

According to BeyondPhilosophy.com:

“Loyal customers reduce costs associated with consumer education and marketing, especially when they become Net Promoters for your organization.”

Hence it is important to be able to proactively determine the customers most at risk of leaving and take preventative measures against this through understanding their needs and providing positive customer experience.

Photo by Sharon McCutcheon on Unsplash

Methodology

The project is divided into 3 stages:

Data Cleaning and Exploratory Data Analysis. Model Selection and Threshold Tuning. Result Interpretation.

Data Cleaning and Exploratory Data Analysis

Data is obtained from Kaggle, IBM Data Sets. The data set has some imbalance with 26.5% churn.

Data is first checked for unique customer ID. Blank spaces are replaced with 0 and columns are changed to numerical type whenever applicable.

EDA is carried out to understand the data. A feature like gender has little impact on churn and will be dropped.

Feature -to-feature correlation is mapped out using a heatmap and features that are highly correlated to one another are dropped (shown below with correlation of > 0.6).

One hot encoding is then carried out on categorical features. And the top 11 features are selected via Random Forest Classification using the algorithm’s feature importance property.

Reducing the number of input features will simplify the problem that is being modeled and speed up the modeling process.

Model Selection and Threshold Tuning

Four models are used to do modeling on the final data: Logistic Regression, C-Support Vector Classification, K Neighbours Classifier and Random Forest Classifier.

GridSearchCV is used to tune the hyperparameters and the best hyperparameter is found for each model.

Based on class 1 classification of threshold 0.5, the logistic regression model is found to have the highest ROC-AUC score, the lowest log-loss, the highest F1 score, and the highest Recall score. Hence the logistic regression model is selected as the final model to further fine-tune the threshold to improve the recall score for our data.

ROC-AUC Score

Log-loss

F1 Score

Precision

Recall

Precision is the fraction of relevant instances among the retrieved instances, while Recall (also known as sensitivity) is the fraction of the total amount of relevant instances that were actually retrieved.

In predicting customer churn, a higher recall would be preferred to a higher precision, because it would be ideal to be able to predict which customers are at a higher risk of leaving. However tuning the threshold to achieve a higher recall comes at the cost of reducing the precision. Hence a balance needs to be achieved. In this project, I have chosen to use F1 score as the metric to select my threshold.

Classification algorithms work by predicting a probability before the probability can be mapped to a class label. This is achieved by using a threshold, such as 0.5, where all values equal or greater than the threshold are mapped to one class and all other values are mapped to another class.

Since the data has a class imbalance, the default threshold can result in a poor classification. As such, it is important to tune the threshold used to map probabilities to the class labels.

At the default threshold of 0.5, the logistic regression model gave an F1 score of 0.58. Based on the maximum F1 score of 0.62, the threshold value turns out to be 0.36. And this new threshold value increased the recall score from 0.55 to 0.78.

Result Interpretation

Based on the logistic regression model, telecommunications companies can focus on the top two features and reduce customer churn by :

Having longer term contract for customers. Improve online security for customers.

Here is a link to my GitHub where you can find my codes and presentation slides. You can also contact me via LinkedIn.