The following research analyzes a dataset from the banking industry to predict the churn rate of current and past customers the bank has had. An Artificial Neural Network Model programmed in Python is utilized to carry out the predictions and the accuracy is calculated.
The experimental results, proportion of customers that have exited and retained, probability density of bank balance, correlation between attributes, top three factors responsible for churn, are all plotted in the form of a variety of graphs.
Python libraries Matplotlib and Seaborn were used for creating the plots. Furthermore, the confusion matrix is calculated along with plotting graphs for the experimental results. Through this research we aim to highlight a model which can be utilized by financial organizations to better track their customer churn patterns.
Implementation Steps
First lets import the libraries needed for Loading the Data and the Data Pre-Processing
We then Load and Pre-Process the Data
We then create our 2 Layered ANN model
Then its time to Train our model
The last few epochs look like the following:
Now that the model has been succesfully trained, we can print out its Accuracy Matrix
From here, now for the Analysis part one is free to visualise the data and the cooreleation between the various customer attributes vs churn possibility. Out of the above list of graph codes one can copy paste the code from the respective files into the main Ann.py file and get the respective graphs.
Visualising our Confusion Matrix by adding the Confusion_Matrix.py file to the main file, ist is often used to describe the performance of a classification model on a test data for which the true values are known. It allows the visualization of the performance of an algorithm:
Visualising our Receiver Operating Characteristic Curve by adding the ROC_Curve.py file to the main file, illustrates the capaability of a binary classifier system. It is created by plotting the true positive rate against the false positive rate.
Visualising our Pie Chart by adding the Pie_Chart.py file to the main file:
Visualising our 6 Counter Plots by adding the Counter_Plot.py file to the main file:
Visualising our Scatter Plots by adding the Scatter_Plot.py file to the main file. The Plots show how much one variable is affected by another.
Visualising our Heat Map by adding the Heat_Map.py file to the main file. The Graph shows the intensity of how one variable affects the proabability of another even happening.
Visualising our Kernel Density Estimate by adding the Heat_Map.py file to the main file,The graph is used for visualizing the Probability Density of a continuous variable.
Visualising our Swarm Plot by adding the Swarm_plot.py file to the main file:
Visualising our Box Plot by adding the Box_Plot.py file to the main file. A boxplot is a standardized way of displaying the distribution of data based on a five number summary (“minimum”, first quartile (Q1), median, third quartile (Q3), and “maximum”).
If you do find this repository useful, why not give a star and even let me know about it!
Feel free to express issues and feedback as well, cheers!