Preventing Customer Churn With Deep Learning

Preventing Customer Churn With Deep Learning

Many organizations have a big problem that can go undiagnosed - customer churn. Actions can be taken to prevent this situation from occurring, but only if organizations can spot the problem and develop strategies to reduce it. In this article, we show how you can use Deep Learning, a specialized subset of Machine Learning algorithms that are capable of high accuracy models, to predict customer churn. The cool thing is we did this in... R. Traditionally, deep learning is performed in Python for computer image recognition and cognitive prediction. I've found that R is a more intuitive language for non-programmers, and I'm excited to show you how this new toolset is available for business analysis!

  • The original article first appeared on the Business Science blog. See the article for full code and examples.
  • The article also appeared on the RStudio TensorFlow blog.
  • Please visit our Services for the deep learning-powered, interactive Customer Health Scorecard.

What's Customer Churn?

The problem of customer churn is often visualized as the act of filling a bucket with holes. An organization spends a lot of time, effort and money attracting customers, but if they don't fix the problems (patch the holes) they end up losing in the end. Think about it: It takes a lot of effort to get customers. Keep them!


It takes a lot of effort to get customers. Keep them!

The Problem: Customers Are Leaving!

We took a data set that the folks at IBM developed for a fictional telecommunications company, Telco. While it was artificially generated, it mimics a real-world scenario that many companies face. It contains 21 features for 7000+ customers, with features covering:

  • 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 Solution: Churn Modeling With Artificial Neural Networks (Keras)

Artificial Neural Networks (ANN) are now a staple within the sub-field of Machine Learning called Deep Learning. Deep learning algorithms can be vastly superior to traditional regression and classification methods (e.g. linear and logistic regression) because of the ability to model interactions between features that would otherwise go undetected. The challenge becomes explainability, which is often needed to support the business case.

Deep learning algorithms can be vastly superior to traditional methods

We used several new techniques to get the best of both worlds (high accuracy + explainability):

  • keras - High-level neural networks API
  • lime - Enables model explainability of deep learning models

Deep Learning With Keras

The keras deep learning model implemented is a feed-forward neural network using two hidden layers and drop out layers in between to reduce overfitting. Here's the R code.

# Building our Artificial Neural Network
model_keras <- keras_model_sequential()

model_keras %>% 
    # First hidden layer
    layer_dense(
        units              = 16, 
        kernel_initializer = "uniform", 
        activation         = "relu", 
        input_shape        = ncol(x_train_tbl)) %>% 
    # Dropout to prevent overfitting
    layer_dropout(rate = 0.1) %>%
    # Second hidden layer
    layer_dense(
        units              = 16, 
        kernel_initializer = "uniform", 
        activation         = "relu") %>% 
    # Dropout to prevent overfitting
    layer_dropout(rate = 0.1) %>%
    # Output layer
    layer_dense(
        units              = 1, 
        kernel_initializer = "uniform", 
        activation         = "sigmoid") %>% 
    # Compile ANN
    compile(
        optimizer = 'adam',
        loss      = 'binary_crossentropy',
        metrics   = c('accuracy')
    ) 

# Fit the keras model to the training data
fit_keras <- fit(
    object           = model_keras, 
    x                = as.matrix(x_train_tbl), 
    y                = y_train_vec,batch_size       = 50, 
    epochs           = 35,validation_split = 0.30
    )

We were able to visualize our training and validation performance to ensure we were getting a well fit model. Applying our model to the test set yielded accuracy in the neighborhood of 82%!

Well, That's Great! But, What Does It Mean?

We have a high accuracy model that's really good at predicting if customers are going to leave. So, what?! We want to know what we can do to change this behavior! Here's where lime comes into play. LIME helps us understand why a model predicts what it predicts. In other words, which features are the most important to whether or not the customer stays?

We ran LIME on the first 10 customers from our test data set (held out during), and here's the visualization. We can see Case 2 and Case 7 were predicted to leave while the others were predicted to stay. Case 7 was particularly likely to leave (78% probability), and it looks like Phone Service = Yes was a leading contributor.

We cross-checked the LIME results with a correlation analysis, which led us to the following features that were targeted for investigation:

  • Tenure (7/10 LIME Cases, Highly Correlated)
  • Contract Type (Highly Correlated)
  • Internet Service (Highly Correlated)
  • Payment Method (Highly Correlated)
  • Senior Citizen (5/10 LIME Cases)
  • Online Security (4/10 LIME Cases)

By investigating the features, we could then develop strategies! Here are a few examples.

Tenure

Opportunity: Target customers with less than 12-month tenure.

Contract Type

Opportunity: Offer promotion to switch to long-term contracts.

Internet Service

Improvement Area: Customers may be dissatisfied with fiber optic service.

Customer Scorecard: An Interactive Web App For The Front Lines!

While strategies are great for high-level decision makers in the organization, what is really needed are actionable tactics that the front-line decision makers can enact.

What is really needed are actionable tactics that the front-line decision makers can enact

Enter the Customer Health Scorecard application! We created a web application to generate actionable recommendations using the deep learning model predictions and lime analysis of features that are important. The app allows the front-lines to build data into their customer retention tactics!

Data Science For Business!

Data science can solve a number of business problems, which translates into improved customer experiences, happier employees, and ultimately better financial performance. In this article, we saw how Deep Learning can be used to predict customer churn, but this is just one of the many challenges that can be solved with data science. If you're interested in using data science for business:

  1. Follow Business Science - Get all the updates and news from Business Science.
  2. Subscribe to the Business Science Blog - This gives you FREE access to data science for business articles, now and into the future.
  3. Enroll in Business Science University - This goes beyond the blog articles, teaching our learners cutting-edge Machine Learning techniques and how to build interactive web applications that can be distributed throughout an organization.
  4. Contact Business Science for consulting services - We'll learn and understand your challenges, build ML models, and make the ML-powered web apps for you! Just contact us.

About The Author

Matt is the Founder of Business Science, a consultancy that helps organizations apply data science to drive ROI and make better decisions. Matt loves feedback. Feel free to connect with/contact him.

Amanda Robinson

Computational Linguist at Samsung

6 年

This is great! Working with sales operations, having new methods to understand customer churn is important

回复
Berkant Ka?ar

Digital User Experience

6 年

This is really nice...

回复
Bernard Zimmermann

Helping Aussie Retailers Streamline Operations with POS Software. Assisted 100+ Stores Boost Efficiency & Enhance Customer Experience.

7 年

I am dubious about this result, we did an extensive study of customer churn in our business and found that it was related to many factors, that were not in our CRM at all, for example, a salesman walks in the door of one of our clients.

Laurent A. Hoareau

FinTech | InsurTech | Technology | Ai & Data Manager

7 年
Radu T.

Retired Telecom Professional

7 年

I believe it when I see actual results. Unlike Go or Chess, churn is not that easily learnable by algorithms.

回复

要查看或添加评论,请登录

?? Matt Dancho ??的更多文章

  • The Data Science Workflow

    The Data Science Workflow

    Data Science is often misunderstood by students seeking to enter the field, business analysts seeking to add data…

    12 条评论
  • 20 Habits To Live By

    20 Habits To Live By

    Most people know me as a data scientist. I founded a company called Business Science, developed an enterprise-grade…

    15 条评论
  • How I Started My Data Science Business

    How I Started My Data Science Business

    Get the full article on Business Science here. This is a true story based on how I created my data science company from…

    56 条评论
  • Data Science For Business Process Framework: Bridging The Gap

    Data Science For Business Process Framework: Bridging The Gap

    Making good decisions is the goal for any business. Good decisions retain customers and employees, which ultimately…

  • 2017 Business Science Blog In Review

    2017 Business Science Blog In Review

    The Business Science Blog has grown tremendously over the past year, fueled by data scientists hungry to learn how to…

    2 条评论
  • Advice From A Mechanical Engineer Considering Data Science

    Advice From A Mechanical Engineer Considering Data Science

    I had a recent conversation with a mechanical engineer that is considering a career change to data science. The MechE…

    17 条评论
  • Machine Learning Applications in Human Resources, Predicting Employee Turnover

    Machine Learning Applications in Human Resources, Predicting Employee Turnover

    Employee turnover (attrition) is a major cost to an organization, and predicting turnover is at the forefront of needs…

    2 条评论

社区洞察

其他会员也浏览了