0% found this document useful (0 votes)
27 views5 pages

Classification Model for Bank Campaigns

classification

Uploaded by

Vinod Krishna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views5 pages

Classification Model for Bank Campaigns

classification

Uploaded by

Vinod Krishna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Project :2 Build a Classification model

Data-set : Bank marketing


One of the largest public sector banks which has several branches across cities
provides various services like savings accounts, current accounts, term deposits,
personal loans, home loans etc. to customers. Whenever the bank conducts
marketing on its new schemes, it will keep track of data related to customers’
personal, social and economic details. Also, it maintains the detailing on efforts
made to achieve success in the campaign. Recently, the bank has conducted a
campaign to market their term-deposit scheme. Campaigns were conducted
based mostly on direct phone calls, soliciting the bank's customers to place a
term deposit. After all the marketing efforts, if the client had agreed to place a
deposit, then the campaign is a success, otherwise not (Target variable marked
'yes', or 'no'). It is a challenge for bank officials to target the right people for a
successful campaign.

Sno Use Case Skill Covered Expected Complexity Industry Total


Outcome Marks

1 Project :2 K neighbours, Understand the Medium- Banking 100


Random Forest, Significance of Complex
Build Gradient Classification
Classification Boosting ML models.
model. algorithms

Tasks 1. Data loading, data cleaning and report analysis. (Weightage 30 Marks)
2. Building ML- Classification Model. (Weightage 70 Marks)
Data Dictionary:

Age: (numeric)
Job : Type of job (categorical: 'admin.', 'blue-
collar', 'entrepreneur', 'housemaid', 'management', 'retired', 'self-employed',
'services', 'student', 'technician', 'unemployed', 'unknown')
Marital : Marital status (categorical: 'divorced', 'married', 'single', 'unknown';
Note: 'divorced' means divorced or widowed)

Education: (categorical: 'basic.4y', 'basic.6y', 'basic.9y', '[Link]', 'illiterate',


'[Link]', '[Link]', 'unknown')
Default: Has credit in default? (categorical: 'no', 'yes', 'unknown')
Housing: Has housing loan? (categorical: 'no', 'yes', 'unknown')
Loan: Has personal loan? (categorical: 'no', 'yes', 'unknown')
Contact: Contact communication type (categorical: 'cellular', 'telephone')
Month: Last contact month of year (categorical: 'jan', 'feb', 'mar', ..., 'nov', 'dec')

Day_of_week: last contact day of the week (categorical: 'mon', 'tue', 'wed', 'thu', 'fri')
Duration: Last contact duration, in seconds (numeric).
Important note: this attribute highly affects the output target (e.g., if duration=0 then
y='no'). Yet, the duration is not known before a call is performed. Also, after the end of
the call y is obviously known. Thus, this input should only be included for benchmark
purposes and should be discarded if the intention is to have a realistic predictive model.
Number of contacts performed during this campaign and for this client (numeric,
Campaign: includes last contact)
Number of days that passed by after the client was last contacted from a previous
Pdays: campaign: (numeric; 999 means client was not previously contacted)
Previous: number of contacts performed before this campaign and for this client (numeric)

Poutcome: outcome of the previous marketing campaign (categorical:


'failure', 'nonexistent', 'success')
Output variable (desired target):
Y: has the client subscribed a term deposit? (binary: 'yes', 'no')

Initial Guidelines:
1. Ensure to follow to Use Id’s provided by UNext for naming file as
conventions.
2. Create GitHub account and submit the GitHub link.
Software Engineering aspect:
Utilize software engineering aspects while building Machine learning model
using modular programming principles to organize your code into reusable
functions or classes to enhance readability, maintainability, and collaboration .
Tasks 1:
T1. Import following datasets (Weightage- 8 marks)
customer_and_bankdetails
customer_campaign_details
customer_response_data
customer_social_economic_data
customer_postal_code_details
state_master
region_code_master
city_master

T2. Create the following dataframes by using relevant merging options and
validate. (Weightage- 14 marks: 2marks each)

First Dataframe : df1 = customer_and_bankdetails and


customer_campaign_details
Validate rows and columns numbers = [37084 rows x 19 columns]
Second Dataframe: df2=df1 and customer_response_data
Validate rows and columns numbers = [37084 rows x 20 columns]

Third Dataframe: df3=df2 and customer_social_economic_data


Validate rows and columns numbers = [37084 rows x 25 columns]

Fourth Dataframe: df4= df3 and customer_postal_code_details


Validate rows and columns numbers = [37084 rows x 26 columns]

Fifth Dataframe: df5= state_master and region_code_master


Validate rows and columns numbers = 49 rows and 4 columns

Sixth Dataframe: df6= city_master, df5


Validate rows and columns numbers = 531 rows and 6 columns

Final Dataframe: df= df4 and df6


Validate rows and columns numbers = 37084 and 31 columns

T3. Export the final data frame df to GitHub for versioning. (Weightage-2 marks)

T4. Reporting (Weightage- 2 marks each)


1. Customer contact mode made.
2. Analysis on attempts made to turn a person into successful depositor.
3. Data analysis on marital status, existing loans, education, profession etc.
and its impact on the campaign’s success
4. Socio-economic analysis of the customers

Initial Guidelines:
1. Ensure to follow to Use Id’s provided by UNext for naming file as
conventions.
2. Create GitHub account and submit the GitHub link.
Task 2: Load the dataset and perform preliminary EDA (Exploratory
Data Analysis) with key observations and insights- (weightage - 35 marks)

T2.1 Import the data stored above using try and except blocks for (weightage - 2
modelling and create data frame “df” marks)
T2.2 Drop the columns from the data frame df: 'Customer_id',
'Region_Code_y','Region_Code_x', 'State_Code_x', "City_Code", '
State_Code_y',
'Postal Code', 'City_Name', 'State_Code_y', 'State_Name', 'Region_Code_y', (weightage - 2
'Region_Name' . marks)
T2.3 Change the order of columns as per data dictionary. (weightage - 2
marks)
T2.4 Get the counts of values for the attribute target variable – ‘y’ (weightage - 2
marks)
T2.5 Check missing values in the data in terms of percentage using error handling
technique
and do missing value treatment.
Hint: Get sum/ percentage of null values to find any missing values if present (weightage - 2
in data or not, for all the attributes in data frame ‘df’ marks)
T2.6 Get total no of rows and columns in the dataset df
(weightage - 2
marks)
T2.7 Get the descriptive statistics for all the columns in the data (weightage - 2
frame. marks)
T2.8 Change pday values if the value is 999 replace with ‘no’ else (weightage - 2
‘yes’ marks)

T2.9 Rename ‘pdays’ column name with ‘bcontacted’ and get value counts and find
number of ‘yes’ and ‘no’. Perform binomial test for proportions on pdays and (weightage - 2
give inferences based on pvalues. marks)
T2.10 Use the below function/ create a function of your own and drop null values
from
('job'), ('marital'), ('education'), ('housing')
Hint:
import numpy as np
def drop(column):
df[column].replace('unknown', [Link], inplace=True) (weightage - 2
[Link](inplace=True) marks)
T2.11 Perform data separation store all categorical variables in ‘cat’ and (weightage - 2
All numeric variables in ‘Numeric’ marks)
T2.12 Create countplot for all categorical varialbles (weightage - 2
marks)
T2.13 Change datatype for ‘month’ and ‘day_of_week’ as ‘str’ (weightage - 2
marks)
T2.14 Create histogram to know the Distribution of Attributes in the data frame df (weightage - 2
and check for normality marks)
T2.15 Get Descriptive Statistics for all numeric variables
Hint: Using the code: [Link](df['campaign'] + 1) perform log (weightage - 2
transformation and create an histogram. marks)
T2.16 (weightage - 2
Drop variable duration. marks)
T2.17 Create Visualizations: Correlations and Scatter plot and find with relevant
statistical function Pearson's coefficient, if there is correlation or not, based (weightage - 2
on p values marks)
T2.18 Perform Feature Engineering for all the features using (weightage - 2
get_dummies function except for target feature y marks)

Task 2: Build model for predicting (weightage - 15 marks)


Hint: Splitting the dataset into X and y, with test_size=0.33
and random_state=42
T2.2.1 RandomForestClassifier(n_estimators=100,
random_state=42), n_features_to_select=20). Save the code (weightage - 5
for model versioning marks)
T2.2.2 KNeighborsClassifier(n_neighbors=10) Save the code for (weightage - 5
model versioning marks)
T2.2.3 GradientBoostingClassifier with options: n_estimators=100,
random_state=42, max_depth=1. Save the code for model (weightage - 5
versioning marks)
Task 3: Evaluate the performance of the model using the right
evaluation metrics.

(weightage - 10 marks)
T3.3.1 Evaluate the above models by getting
accuracy, Precision, Recall, F1 Score, Kappa
Score. Perform Hyperparameter tuning. Re
build the model with best suitable modelling
technique (weightage - 2 marks)
T3.3.2 Using Lime/SHAP libraries, explain the
prediction of your regression model and give
inferences.
Implement unit test case and deploy the above
models using Flask/ Stream lit (weightage - 3 marks)

Task 4: Summarize the findings of the analysis and draw conclusions


with PPT / PDF. (weightage - 15 marks) (ME)
Final Submission guidelines:
1. Download the Jupyter notebook in the format of html.
2. Upload it in the lumen (UNext LMS)
3. Take a screenshot of T15 (Deployment) and upload it in the lumen
(UNext LMS)
4. Summarized PPT/ PDF prepared in Task 4 to be uploaded in the
lumen (UNext LMS)

You might also like