top of page

Customer Forecasting

Demand forecasting is the process of using predictive analysis of historical data to estimate and predict customer's future demand for a product or service. Demand forecasting helps the business make better-informed supply decisions that estimate the total sales and revenue for a future period of time

The main aim or goal is that we will do customer forecasting and predict that he will leave the bank or not.

We will go here step by step with coding so you will understand how it works and also i will show you the interface part that how does it look's and also i will be mentioning the github link at last so you can go and check it out for End to End deployment soo let's start

Import Library

Load Dataset

Here we are using churn_modelling dataset you gave go to the kaggle and download it.


Now first off all we will have look on the info of dataset as well as it's describe from here will try to know about your data .

Now we will plot the histogram for the dataset for more information with the help of matplotlib

Now we will see the correlation of dataset that how much the are correlated with each other using Heatmap.

Here we will check the length of the data as well as shape and then we will see the feature 'Geography' as we see that their are 3 country mention in it soo we will do it's label encoding and also same for gender feature too.

Now look to the data how it look's like

Look to the data and generate x & y as independent and dependent feature respectively.(fig below)

Hyper-parameter Tuning

First we will declare all the parameters which we need like learning rate , gamma etc and always remember learning rate should be between 0 to 1 only.

Now as usual import library for Hyper-parameter tuning and your Machine learning model.

Here we are using Random search for Hyper-parameter tuning you can also use Grid search it's up to you and also we are using Xgboost because it is robust to the outliers .

Now initialize the random search and pass the parameters and just check for the best_estimetors.

Now its time to fit the model and then predict the accuracy using f1 score you can check accuracy by different accuracy parameter also .

your F 1 score is pretty good. It's time for you to do hand's on it.

This is how web app looks like after deployment for customer forecasting (code mentioned above) and i am also mentioning my web app link soo you can see this.

If you guys want its code and want to end to end with deployment here i am attaching my github link :

References and credit

Krish Naik - He is an amazing teacher for Data Science you can just visit to his Youtube channel and explore this all concept.

Your feedback is appreciated!

Did you find this Blog helpful? Any suggestions for improvement? Please let me know by filling the contact us form or ping me on LinkedIn .


151 views0 comments

Recent Posts

See All
bottom of page