Predicting Churn for Bank’s Customer using ANN
Predicting Churn for Bank’s Customer using ANN
Photo by Vic López on Dribbble

Churn is a process where an individual stops doing his work/business with a particular entity. Churning or Attrition can happen anywhere such as Employee churn, customer churn, etc. This process is quite tedious to understand, as there is no fixed pattern or formula to calculate.

Bank Customer Churn: Its a type of churning where the entity loses its customer’s or clients. Due to which, banks suffers from huge losses or even can go bankrupt. So to avoid such things, banks should take necessary precautions.

In this blog, we are going to explain how deep learning can be useful to track down customers based upon certain parameters such as age, balance, location, no of credit cards, etc.



Table of Contents:

→Dataset

→Data Visualization

→Data Preprocessing (Feature Scaling And Encoders)

→Model Evaluation

→Graph Plotting

→Model Prediction

DataSet:

The dataset is available on Kaggle which was given by Adam.

https://www.kaggle.com/adammaus/predicting-churn-for-bank-customersAdam

The dataset contains 14 rows and 10000 rows, and has both categorical as well as numerical data.

Data Visualization:

Basically, data visualization gives us a clear picture of what the data means by putting it in context via maps, graphs, and heatmaps. This makes the data easier to interpret for the human mind, making it easier to see trends, patterns, and outliers within data sets.

There are various tools for visualization such as

>Matplotlib

>Plotly

>Seaborn

>GGplot

>Bokeh

Here we will be using Seaborn, which is an excellent tool when it comes to draw heat maps.

Heatmap
Heatmap

Feature Scaling:

It’s one of the most important preprocessing step for many ML/DL models. Its work is to normalize the given range of features or independent variables.

There are various methods available for scaling the features, but the most 2 common methods are Normalization and Standardization.

In this model, we have used Standard Scaler which removes the mean and scale to unit variance to standardize characteristics.

One Hot Encoder V/s Label Encoder

We have used Label Encoder for “gender” column and One hot encoder for “geography” column.

The reason for using label encoder was, there were 2 entity such such as Male and Female, so we just needed to convert the existing data with new data.

The reason for using one hot encoder was, there were 3 countries mentioned in the dataset. Now for eg, if we gave 0 to France, 1 to Germany then the 3rd country ie Spain will not be assigned anything.

So using one hot encoder will be useful as it does the work as mentioned below:

  • 0/1 0/10/1
  • France 1 0 0
  • Spain 0 1 0
  • Germany 0 0 1

Model Training:

We have using ANN for training the model,

epoch_size=25

optimizer=adam

Graph Plotting:

Train VS Validation(Loss)
Train VS Validation(Loss)
Train VS Validation (Accuracy)
Train VS Validation (Accuracy)

Model Prediction:

The model was able to yield an accuracy of 86.40%.

The model returns 2 values:

False: If the customer will not will the bank, then the model will return this value.

True: If the customer will leave the bank, then the model will return this value.

eg.

Link :

Click the below link to access the Notebook.

https://cainvas.ai-tech.systems/use-cases/predicting-churn-for-bank-customers-app/

Credit: Tanmay

 

You may also be interested in

Become a Contributor: Write for AITS Publication Today! We’ll be happy to publish your latest article on data science, artificial intelligence, machine learning, deep learning, and other technology topics