Brain logo

Telecommunications churn

By Pablo Martin, Artelnics.

Customer churn is a big problem for telecommunications companies since it impedes growth. For that reason, it is important that the companies are aware of churn rate in order to develop strategies that allows them to keep as many clients as possible.

Telecommunications churn

The aim of this study is to use advanced analytics in order to understand why customers do churn and what can be done about it.

1. Data set

The data set contains a total of 3333 instances, each of them corresponding to a client of a telecommunications company for whom it has been collected information about the type of plan that they have contracted, the minutes that they have talked or the charge that they pay every month, among others.

The target variable is "churn" and it is the one that determines whether the client is still in the company or not.

The first step of the analysis is to check the basic statistics of all te variables. The next table shows a list of them for each of the 18 inputs and the target.

Variables description

As we can see, the average bill in this company has a cost of 59.45$ and the average number of calls to customer service is 1.56.

The logistic correlations will give us the importance of single input variables with the target.

Correlation chart

As we can see, most clients leave because of high prices, high rate of day calls, high rates of international calls without plan and technical services.

Before starting the predictive analysis, it is also important to know the ratio of negative and positive instances that we have in the data set.

Target distribution

The chart shows that there are 2850 loyal customers and 483 churn customers in our data set, that is, there are 6 loyal clients for each churn client.

2. Neural network training

Once we have study the available data, we can move to the design of the predictive model and its training.

The predictive model is represented by a neural network. The architecture, which is shown below, consists of 18 scaling neurons (yellow), 5 neurons in the first layer (blue) and 1 probabilistic neuron (red).

Neural network

As we saw before, the data set is unbalanced. In that way, we will set the weighted squared error as error method. The next chart shows how the loss decreases during the training process with the iterations of the Quasi-Newton method.

Training chart

As we can see, the initial value is 1.24397, and the final value after 173 iterations is 0.333412.

The next table shows more information about the results of the training with the quasi-Newton method.

Loss history

They show that the selection loss and the final parameters norm are not big and that the analysis of all the training instances was made in 12 seconds.

3. Testing analysis

Once the model has been trained, it is time to evaluate its performance on new data that have not been used neither for training nor for selection.

Firstly, we are going to calculate the binary classification tests. They are calculated from the values of the confusion matrix.

Binary tests

The accuracy shows that the model can predict correctly almost the 92% of all the testing instances while the error rate shows that it only fails to predict around 8% of them. The value of the sensitivity is 0.769231, which means that the model can detect around the 70% of the positive instances. The specificity is 0.8939502, so it can detect around 90% of the negative instances.

These binary classification tests show that the model can predict correctly most of the instances.

We are going to calculate now the ROC curve. It will help us to measure the discrimination capacity of the classifier between positives and negatives instances. The next chart shows the ROC curve for our problem.

ROC curve

The proximity of the curve to the upper left corner means that the model has a good capacity to discriminate between the two classes.

The most important parameter that we can obtain from the ROC curve is the area under the curve. This value takes the value 0.5 for a random classifier and takes de value 1 for a perfect one. In practice, it should ideally be as close to 1 as possible. The next table shows the value of this parameter in this case.

Area under curve

The area under curve is 0.896 which shows that our model is predicting well the churn of our customers. In this way, we can move it into the production phase to estimate the probability of churn of new ones.

4. Model deployment

The predictive model takes the form of a function of the outputs with respect to the inputs. The mathematical expression, which is listed below, represented by the model can be used to embed it into another software and can be used prevent customers from doing churn.

scaled_account_length=2*(account_length-1)/(243-1)-1;
				scaled_voice_mail_plan=2*(voice_mail_plan-0)/(1-0)-1;
				scaled_voice_mail_messages=2*(voice_mail_messages-0)/(51-0)-1;
				scaled_day_mins=2*(day_mins-0)/(350.8-0)-1;
				scaled_evening_mins=2*(evening_mins-0)/(363.7-0)-1;
				scaled_night_mins=2*(night_mins-23.2)/(395-23.2)-1;
				scaled_international_mins=2*(international_mins-0)/(20-0)-1;
				scaled_customer_service_calls=2*(customer_service_calls-0)/(9-0)-1;
				scaled_international_plan=2*(international_plan-0)/(1-0)-1;
				scaled_day_calls=2*(day_calls-0)/(165-0)-1;
				scaled_day_charge=2*(day_charge-0)/(59.64-0)-1;
				scaled_evening_calls=2*(evening_calls-0)/(170-0)-1;
				scaled_evening_charge=2*(evening_charge-0)/(30.91-0)-1;
				scaled_night_calls=2*(night_calls-33)/(175-33)-1;
				scaled_night_charge=2*(night_charge-1.04)/(17.77-1.04)-1;
				scaled_international_calls=2*(international_calls-0)/(20-0)-1;
				scaled_international_charge=2*(international_charge-0)/(5.4-0)-1;
				scaled_total_charge=2*(total_charge-22.93)/(96.15-22.93)-1;
				y_1_1=Logistic(-1.30033
				+0.637015*scaled_account_length
				+0.0393358*scaled_voice_mail_plan
				-5.82405*scaled_voice_mail_messages
				+1.79053*scaled_day_mins
				+0.83293*scaled_evening_mins
				-1.72581*scaled_night_mins
				-2.37616*scaled_international_mins
				-10.8532*scaled_customer_service_calls
				-2.86825*scaled_international_plan
				+4.16865*scaled_day_calls
				+1.16784*scaled_day_charge
				-5.3673*scaled_evening_calls
				+1.33519*scaled_evening_charge
				-0.608825*scaled_night_calls
				-1.75137*scaled_night_charge
				+1.91124*scaled_international_calls
				-2.27788*scaled_international_charge
				+1.62271*scaled_total_charge);
				y_1_2=Logistic(1.59651
				-1.07704*scaled_account_length
				+4.53594*scaled_voice_mail_plan
				+0.61956*scaled_voice_mail_messages
				-6.89015*scaled_day_mins
				-3.43252*scaled_evening_mins
				-2.40047*scaled_night_mins
				-0.396724*scaled_international_mins
				-0.601073*scaled_customer_service_calls
				-14.0287*scaled_international_plan
				-0.0636771*scaled_day_calls
				-6.6308*scaled_day_charge
				-0.105657*scaled_evening_calls
				-3.13658*scaled_evening_charge
				+0.676836*scaled_night_calls
				-1.9957*scaled_night_charge
				-0.0327261*scaled_international_calls
				-0.473655*scaled_international_charge
				-6.94902*scaled_total_charge);
				y_1_3=Logistic(-0.969905
				+1.36834*scaled_account_length
				-8.20209*scaled_voice_mail_plan
				-3.11385*scaled_voice_mail_messages
				-0.906752*scaled_day_mins
				-1.30331*scaled_evening_mins
				+0.0380725*scaled_night_mins
				-0.745686*scaled_international_mins
				+16.3766*scaled_customer_service_calls
				+9.17741*scaled_international_plan
				+0.956511*scaled_day_calls
				-0.920564*scaled_day_charge
				-0.213765*scaled_evening_calls
				-1.06249*scaled_evening_charge
				+0.956586*scaled_night_calls
				+0.0853414*scaled_night_charge
				-0.408304*scaled_international_calls
				+0.242594*scaled_international_charge
				-1.45709*scaled_total_charge);
				y_1_4=Logistic(0.574828
				-0.893955*scaled_account_length
				-0.20444*scaled_voice_mail_plan
				+3.86573*scaled_voice_mail_messages
				-0.523631*scaled_day_mins
				-1.39468*scaled_evening_mins
				+0.305891*scaled_night_mins
				-2.42724*scaled_international_mins
				+2.10121*scaled_customer_service_calls
				+5.67623*scaled_international_plan
				+4.68078*scaled_day_calls
				-1.05364*scaled_day_charge
				+3.47435*scaled_evening_calls
				-1.62874*scaled_evening_charge
				-2.71217*scaled_night_calls
				-0.13464*scaled_night_charge
				+6.97242*scaled_international_calls
				-2.99021*scaled_international_charge
				-1.67972*scaled_total_charge);
				y_1_5=Logistic(2.12545
				-0.850065*scaled_account_length
				+3.52634*scaled_voice_mail_plan
				+4.39994*scaled_voice_mail_messages
				-0.966255*scaled_day_mins
				+0.654635*scaled_evening_mins
				-3.80164*scaled_night_mins
				+0.739805*scaled_international_mins
				-6.99532*scaled_customer_service_calls
				-10.0732*scaled_international_plan
				+1.12768*scaled_day_calls
				-1.37971*scaled_day_charge
				-0.256382*scaled_evening_calls
				+0.725276*scaled_evening_charge
				+1.15786*scaled_night_calls
				-4.57706*scaled_night_charge
				+0.359499*scaled_international_calls
				+0.668258*scaled_international_charge
				-1.58351*scaled_total_charge);
				non_probabilistic_churn=Logistic(2.05034
				-7.13021*y_1_1
				-11.8273*y_1_2
				+8.98323*y_1_3
				-7.07882*y_1_4
				+14.4524*y_1_5);
				(churn) = Probability(non_probabilistic_churn);

				Logistic(x){
					return 1/(1+exp(-x))
				}

				Probability(x){
					if x < 0
						return 0
					else if x > 1
						return 1
					else
						return x
				}'
				

Bibliography

  • The data used for this example can be downloaded from Iain Pardoe.