NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > Capstone > Machine Learning on Bank Marketing Data

Machine Learning on Bank Marketing Data

Connie Zhang
Posted on Dec 23, 2016

Introduction

Retail Banking is a provision of the services by banks to an individual consumer. Such services offered include savings/transaction accounts, mortgages, personal loans, and credit/debit cards. It is a very competitive business.
One of the biggest challenges the business faces is figuring out how to identify condumers who are most likely to do business with it and target those who have suitable needs to sign up for its services. Because of that, the marketing of services plays a vital role in winning customers over.

In this study, we have implemented multiple muchine learning algorithms on a marketing data set of an European retail bank. The goal is to understand the important factors on short-term deposit account sign-ups and to develop a strategy to help banks focus on those most promising leads in order to win them over.

The Data

The data set used here is from UCI machine learning repository. It is derived from the direct marketing campaigns of a Portuguese banking institution. The marketing campaigns were based on phone calls. Often, more than one contact to the same client was required, in order to access if the product (bank term deposit) would be ('yes') or would not be('no') subscribed.

The following categories of information are included in the data set:

Consumer data: Age, sex, job and marital status, education, loan status, and so on.
Campaign activities: When and how to contact, times to contact, outcome of previous campaigns.
Social and economic environment data: Euribor 3 month rate, employment variation rate, consumer price index, and
consumer confidence index.
Outcome:  A 'yes' for the bank if there is a term deposit subscribed, a 'no' for the other outcome.

Data Visualization and Pre-processing

The data set contains 12 categorical variables and 7 numerical variables as its features and a binary category as its response variable. The following plots show the relationships between its economic numerical variables and the distribution of the response variable.

nfeatures                       responsv
The plot on response variable shows highly unbalanced distribution of its binary classes. The relationships between the economic data are non-linear. Economic data is not normally distributed. In order to fit machine learning algorithms, all the categorical variables and response variable are encoded into numerical levels.

This data set also contains missing data on one numerical feature: pdays. This feature indicates the number of days that passed by after the client was last contacted from a previous campaign- it was coded as '999' if the contact never happened. Over 90% of the records show a number missing for the pdays. In order to implement the machine learning algorthms, we need to imput the missing values of this feature in a way to maximize its prediction accuracy.

In the study, we tested the following appraches with the Logistic Regression algorithm:

  1. Leave it as it is (999)
  2. Imput as the column mean
  3. Imput as zero
  4. Remove the column from data set

Since the result shows the highest prediction accuracy on the first apprach. we will keep the data as it is in the rest of study.

The Models and Model Optimizations

In order to meet the goal set up above, we need to develop a classification model with a balanced ability of giving correct prediction on both consumer sign-ups and no sign-ups. This model is considered as suitable since it can help marketing personnel to focus on those promising leads and reduce or eliminate effort on those who are unlikely to conduct business with them.  To develop such model, we implemented:

  1. Rebalance the train data: Oversample the minority class to overcome the unbalanced response output
  2.  Implement multiple classification algorithms: Explore different classification algorithms to seek the best fit
  3. Redefine model evaluation criteria: Focus on model sensitivity rather than overall accuracy
  4. Implement grid search cross validation: Find optimal model parameters
  5. Develop validation curves: Keep overfitting in check
  6. Evaluate sensitivity: Compare sensitivity through Classification Reports

The Results

The algorithms used in the study consist of Logistic Regression, Radom Forest, Gradient Boosting, Support Vector Classifier and Neural Network. Without oversampling and parameter optimization, all algorithms show around 90% accuracy overall but about 20% sensitivity on fitting and prediction of custmer sign-ups.  After rebalancing the training data and grid search cross validation, all the algorithms except the Support Vector Classifier showed improvement on balanced sensitivities and the top two improvements were from Gradient Boosting and Neural Network. The following outputs are then generated from Logistic Regression, Gradient Boosting and Neural Network. Here Logistic Regression  is served as a baseline other algorithm to be compared with.

Logistic Regression:  baseline                         Gradient Boosting:                                Neural Network:
On train set:                                                         On train set:                                            On train set:
          precision recall f1-score  support              precision recall f1-score  support           precision recall f1-score  support
 class 0      0.91  0.99       0.95     29229     class 0      0.95  0.83       0.89    29229     class 0   0.96   0.44      0.60     29229 
 class 1      0.67  0.24       0.35       3721     class 1      0.34  0.67       0.45       3721     class 1   0.16   0.84      0.27       3721  
avg/total   0.88   0.90      0.88     32950    avg/total    0.88  0.82       0.84    32950  avg/total   0.87   0.49      0.57     32950      

On test set:                                                           On test set:                                               On test set:  
           precision recall f1-score  support             precision recall f1-score  support           precision recall f1-score  support
 class 0      0.91   0.99       0.95        7319     class 0    0.95    0.84     0.89       7319     class 0   0.96    0.43       0.60       7319
 class 1      0.66   0.23       0.35         919      class 1    0.34    0.66     0.45         919     class 1    0.16    0.84       0.26         919
avg/total    0.88   0.90       0.88       8238   avg/total   0.88    0.82     0.84       8238  avg/total   0.87    0.48       0.56       8238

The highlighted data shows that the sensitivity of sign-ups on fitting the train data has been increased from 24% on baseline to 67% on Gradient Boosting, and to 84% on Neural Network Classifier and that the coressponding improvements on the test set have raised from 23% to 66% and then further to 84%. By improving the sensitivity on class 1, we improve the ability of these models to predict customer sign-ups. However, sensitivity on class 0 has been reduced from 99% on baseline to 83% on Gradient Boosting, and to 44% on Neural Network on train data and from 99% to 84% and then further to 43% on test set. The reduction of sensitivity on class 0 will reduce the ability to predict no sign-ups correctly.

Further,  let's take a look at the prediction distributions on test set:
Baseline:                                           Gradient Boosting:                                Neural Network:
lrfinal                            gbfinal                            nwfinal
Compared with those true values, the prediction output on test set shows:
1. The baseline model is accrurate in making predictions in general: It is able to predict correctly over 90% of the time. However, it can only predict customer sign-up correctly 23% of the time. So the model is not informative enough to our project goal.
2. Gradient Boosting has been improved on predicting customer sign-ups correctly to 66% of the time and it is able to filter out those who will not sign-up 84% of the time.
3. Neural Network has been improved further on predicting sign-ups correctly to 84% of the time, however, its ability of filtering out those who will not sign-up was reduced to 43% of the time.
4.  Compared with Gradient Boosting,  Neural Network prediction is more expensive because of its failure to identify those who will not sign up.

Finally, as shown below, both Random Forest and Gradient Boosting are able to identify those features which have important impacts on the response variable. These outputs supply very valuable insight to guide further marketing campaign.
From Random Forest:                                                                                           From Gradient Boosting:
featureimportancerf                                                    featureimportancegbt
The differences of feature importances reflect the differences of mechanism between thees models.

Conclusion

In this study, we have applied machine learning techniques to retail bank marketing data and explored how the techniques can be used to help  the bank to conduct its marketing campaign:

  1. Multiple Classification Algorithms have been evaluated.
  2. Oversampling/undersampling has been implemented for unbalanced data.
  3. Cross Validation was used for parameter selection.
  4. Gradient Boosting is the best model for balanced sensitivities and interpretation of feature importance.
  5. Neural Network has the best ability to predict sign-ups but gives no insight on feature influence.
  6. Both Gradient Boosting and Neural Network can add value to further a marketing campaign.

 

 

About Author

Connie Zhang

Connie Zhang, a marketing specialist, has been working in the field of data analysis since 2010. She holds a Ph.D. in Engineering,MBA and an Associateship of the Society of Actuary in United States.
View all posts by Connie Zhang >

Related Articles

Capstone
The Convenience Factor: How Grocery Stores Impact Property Values
Capstone
Acquisition Due Dilligence Automation for Smaller Firms
Capstone
Using NLP to Explore Unconventional Targets
Capstone
Blind Dating Ensemble Classifier
Student Works
Data Driven Ads by Starbucks Customer Segmentation

Leave a Comment

Cancel reply

You must be logged in to post a comment.

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day ChatGPT citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay football gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income industry Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application