TNS
VOXPOP
Where are you using WebAssembly?
Wasm promises to let developers build once and run anywhere. Are you using it yet?
At work, for production apps
0%
At work, but not for production apps
0%
I don’t use WebAssembly but expect to when the technology matures
0%
I have no plans to use WebAssembly
0%
No plans and I get mad whenever I see the buzzword
0%
ARCHITECTURE
ENGINEERING
OPERATIONS
CHANNELS
THE NEW STACK

# Build a Churn Detection Train with AI Blueprints

Building a churn detector is easy with AI Blueprints.
Jan 17th, 2023 10:00am by

My first AI Blueprints tutorial went over the types of recommendation systems and how to create a recommendation system using a Blueprint without writing model code. One of the lessons learned was how easy it was to create and scale an ML pipeline. AI Blueprints can not only be used to create recommendation systems but can also be used for NLP, computer vision, anomaly detection and more. This particular tutorial dives into what customer churn is and how to use AI Blueprints to clean and validate data in order to train multiple models to predict if a customer is likely to churn or not.

## What Is Customer Churn?

Customer churn can be defined as the percentage of customers who have stopped using a company’s product during a specified time. It is important to keep track of customer churn because it traditionally costs [a lot] more to get a new customer than it does to keep an existing customer. Furthermore, repeat customers are more likely to spend more than new customers.

Customer churn rate can be calculated using the equation below.

### Example: Calculating a Customer Churn Rate

Say you start a year with 1,000 customers and lose 95 customers over the time period. The calculation below shows that the customer churn rate is 9.5%.

Companies try to keep the churn rate as low as possible. The problem is that predicting if a customer will churn is difficult and can require extensive data science expertise and domain knowledge. That is where AI Blueprints can help.

## Using AI Blueprints to Predict If a Customer Will Churn or Not

Caption: This is the pipeline we will be utilizing in this tutorial.

In this tutorial, we will use AI Blueprints to clean and validate data in order to train multiple models to predict if a customer is likely to churn or not based on their individual characteristics. The image above shows a flow that, in cnvrg, is a production-ready machine learning pipeline that allows you to build complex DAG (directed acyclic graph) pipelines and run your ML components by dragging and dropping.

Before creating a customer churn predictor, it is important to take a step back and briefly mention the types of AI blueprints.

Three common types of blueprints are:

• Inference: These are pre-trained and ready to be used immediately. All you need to do is one-click deployment of the blueprint to your own infrastructure. This is good for use cases like object detection, text detection and sentiment analysis.
• Training: These types of blueprints are either for fine-tuning or training a model. These perform best on your specific data. You need to provide it with your own dataset. In the training, the blueprint will try to find the best model that performs best on your data and makes it easy to deploy it at the end of the process.
• Components: It allows you to mix and match connectors with models and deployment options and create your own story.

This tutorial will be utilizing a training blueprint.

### Selecting the Blueprint

To be able to follow along with this part of the tutorial, you will need to sign up or log in to cnvrg.io Metacloud. Once you’ve created a user name, you will get a screen similar to the one below.

The next step is to select Blueprints.

Next, type in churn detection train.

Click on Churn Detection Train. You will get to a screen similar to the one below.

Next, click on Use Blueprint and then Continue. You will see a flow diagram.

This blueprint consists of the following components:

• The S3 Connector is used to get data from S3. This tutorial uses prebuilt data example paths that have already been provided so you will not need to upload your own dataset. Other blueprint tutorials have shown how to upload and use your own dataset.
• Data-preprocessing makes sure the data is formatted correctly. It also handles null values.
• Train Test Split splits the data into training and test sets. This will be used to help assess how well the algorithm performs.
• Multiple model training occurs after splitting the data. This blueprint trains Naive Bayes, SVC, Random Forest and Logistic Regression. Naturally, it is easy to adjust this to more or less models.
• The Compare component compares models against a common metric between all the algorithms.
• Inference is the component that can be used for deployment. This allows you to take the model and get predictions from it by using it as an API.

### Run Blueprints

Click “Run

Depending on your metacloud account, it might take a couple of minutes to run. If you see that the status of everything is successful, you have successfully created a customer churn detector!

The image above just shows that the blueprint ran successfully. From here, you can view the customer churn probability. In the image below, a higher prediction probability means a customer is more likely to churn. This insight can be used by the business unit responsible for churn to nurture or attempt to re-engage the customer with extra support.

## Conclusion

Building a churn detector is easy with AI Blueprints! If you would like to learn more about AI Blueprints or Metacloud, consider coming to our next webinar. If you have any questions or would like to share what you are building with AI Blueprints, you can post in the cnvrg.io community or mention us @cnvrg_io on Twitter.

THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.