How to predict customer churn using BigML
Have you ever received that “Come back, we miss you!” promotional emails with a personalized free gift card or those out of the blue 50% off deals from those businesses you used to buy things from? I have always wandered why the sudden love and attention — not to complain about the unsolicited love and attention I’m receiving, but something definitely seems a bit “sus” here. Then I learned the existence of customer churn prediction models and things definitely started to make more sense. Did it hurt my ego to know that it’s just an automated mail from a machine learning model that predicted I’m more likely to leave the business? Obviously yes, but I’ll get over it.
My attempt here is to teach anyone who has a business (big or small) to use their own customer data to identify which of their current customers are more likely to churn by using a free machine learning platform called ‘BigML’ — so that you can show them some extra love and make them active customers again. And for demonstration purposes, I will be using a data set from Kaggle with customer information of a telecommunication provider.
Getting started with ‘BigML’
To get started, Big ML has a set of introductory videos that will help anyone get started with the platform. After you get a feel for the platform and all the cool things that it can do, head over to your dashboard on the right corner and get started.
Once you get to your dashboard, head on to the sources tab and upload your dataset as a csv or xls . And after you convert your file from a source to a dataset using the “1-CLICK-DATSET” feature, you can use the ‘TRAINING|TEST SPLIT” function to split the dataset randomly to your preferred split (80–20/70–30).
Now you can start building machine learning models with so much ease. For this example, we will be creating some of the most popular supervised classification models out there to predict churn: Decision Trees, Bootstrap Forests, Random Forests, and Logistic Regression.
Model Evaluation
Before jumping into comparing model performances, it would be good to have an idea of what these models do and what some of these evaluation metrics mean cause “a model is only as good as the metrics that are used to evaluate it”.
What do these Machine Learning models simply mean?
- Decision Trees: “a type of supervised machine learning model used to categorize or make predictions based on how a previous set of questions were answered”
- Bootstrap Model: “the idea is to create several subsets of data from training sample chosen randomly with replacement. Now, each collection of subset data is used to train multiple decision trees instead of just one. Average of all the predictions from different trees are used which is more robust than a single decision tree”
- Random Forests: “is an extension over the bootstrap model. It takes one extra step where in addition to taking the random subset of data, it also takes the random selection of features rather than using all features to grow trees”
- Logistic Regression: “this model can only be used when the dependent variable is categorical. It is used to describe data and to explain the relationship between one dependent categorical variable and one or more independent variables”
What metrics are we using and what questions are those metrics asking in this specific context?
- Accuracy: out of all the customers, how many were correctly predicted into their relevant category?
- Precision: out of all the customers that are predicted to churn, how many actually churned?
- Recall: out of all the customers who actually churned, how many were predicted as churned?
- F-measure: harmonic mean of the model’s precision and recall
Higher accuracy is the most desired metric in most ML competitions — but is it fair to give the same level of importance for accuracy in an imbalanced data set like this where 86% of the data falls into the “Not churn” class and only 14% for “Churn”. Which means I could predict someone to not churn and be right 86% of the time! So a better metric to evaluate in such cases would be to look at Recall instead. Since that metric gives accuracy of our model in predicting the classification of interest (“churn” in this case) instead of both categories.
Now that there’s a sufficient amount of knowledge on the four models and the comparison metrics, we can start comparing the models! Below are the outputs that we get from BigML when we use its “Model Evaluation” function.
Model Comparison
To summarize the outputs above, we can use the below table to easily compare the given evaluation metrices. And it is evident that from the metrices that we discussed above, Random Forest and Bootstrap Forest models perform the best from the four models we used.
Now this is all cool but let’s not forget the business problem that we initially wanted to solve. Our task was not to pick the best performing ML model; it was to figure out which one of the current customers are more likely to churn. And you can carry out this task on BigML itself by going to your model and using the “Predict” function as done below.
And that should do it! I hope you learned about how convenient it is to build machine learning models using BigML, while also getting a sense of how the models that we created above can be used as a starting point in any business to reduce churn. So get your data cleaned up, use BigML to identify those risky customers, and start showing them some love to make them stay with your business!