Sudheer17 commited on
Commit
55dd5bd
Β·
verified Β·
1 Parent(s): 4af6342

Update Readme.md

Browse files
Files changed (1) hide show
  1. Readme.md +282 -0
Readme.md CHANGED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🏦 Bank Customer Churn Prediction using Artificial Neural Network (ANN)
2
+
3
+ ## Overview
4
+
5
+ This project is an AI-powered **Bank Customer Churn Prediction System** developed using **Deep Learning (Artificial Neural Networks)**. The application predicts whether a customer is likely to leave the bank based on their personal and financial information.
6
+
7
+ The model is deployed using **Streamlit** and can be easily hosted on **Hugging Face Spaces** for public access.
8
+
9
+ ---
10
+
11
+ ## Features
12
+
13
+ * Deep Learning-based customer churn prediction
14
+ * Interactive Streamlit web interface
15
+ * Real-time predictions
16
+ * Standardized input preprocessing using StandardScaler
17
+ * Probability score for each prediction
18
+ * Clean and user-friendly interface
19
+
20
+ ---
21
+
22
+ ## Dataset
23
+
24
+ The project uses the **Bank Customer Churn Dataset**.
25
+
26
+ ### Input Features
27
+
28
+ | Feature | Description |
29
+ | --------------- | ---------------------------------------- |
30
+ | CreditScore | Customer's credit score |
31
+ | Gender | Male or Female |
32
+ | Age | Customer age |
33
+ | Tenure | Number of years with the bank |
34
+ | Balance | Current account balance |
35
+ | NumOfProducts | Number of bank products owned |
36
+ | HasCrCard | Whether the customer has a credit card |
37
+ | IsActiveMember | Whether the customer is an active member |
38
+ | EstimatedSalary | Estimated annual salary |
39
+
40
+ ### Target Variable
41
+
42
+ | Target | Meaning |
43
+ | ------ | ----------------------- |
44
+ | 0 | Customer Stays |
45
+ | 1 | Customer Leaves (Churn) |
46
+
47
+ ---
48
+
49
+ ## Technologies Used
50
+
51
+ * Python
52
+ * TensorFlow / Keras
53
+ * NumPy
54
+ * Pandas
55
+ * Scikit-learn
56
+ * Joblib
57
+ * Streamlit
58
+
59
+ ---
60
+
61
+ ## Deep Learning Architecture
62
+
63
+ * Input Layer: **9 Features**
64
+ * Hidden Layer 1: Dense Layer (ReLU)
65
+ * Hidden Layer 2: Dense Layer (ReLU)
66
+ * Output Layer: Dense Layer (Sigmoid)
67
+
68
+ ### Activation Functions
69
+
70
+ * ReLU
71
+ * Sigmoid
72
+
73
+ ### Loss Function
74
+
75
+ Binary Crossentropy
76
+
77
+ ### Optimizer
78
+
79
+ Adam Optimizer
80
+
81
+ ### Evaluation Metric
82
+
83
+ Accuracy
84
+
85
+ ---
86
+
87
+ ## Data Preprocessing
88
+
89
+ The following preprocessing steps were applied before training:
90
+
91
+ * Removed unnecessary columns
92
+ * Encoded Gender
93
+ * Feature Scaling using StandardScaler
94
+ * Train-Test Split
95
+ * Normalized numerical features
96
+
97
+ The trained StandardScaler is saved as:
98
+
99
+ ```
100
+ scaler.pkl
101
+ ```
102
+
103
+ to ensure identical preprocessing during deployment.
104
+
105
+ ---
106
+
107
+ ## Model Files
108
+
109
+ ```
110
+ ann_model.h5
111
+ ```
112
+
113
+ Trained Artificial Neural Network model.
114
+
115
+ ```
116
+ scaler.pkl
117
+ ```
118
+
119
+ Saved StandardScaler used during training.
120
+
121
+ ```
122
+ app.py
123
+ ```
124
+
125
+ Streamlit application.
126
+
127
+ ---
128
+
129
+ ## Project Structure
130
+
131
+ ```
132
+ Bank-Customer-Churn-Prediction/
133
+ β”‚
134
+ β”œβ”€β”€ app.py
135
+ β”œβ”€β”€ ann_model.h5
136
+ β”œβ”€β”€ scaler.pkl
137
+ β”œβ”€β”€ requirements.txt
138
+ β”œβ”€β”€ README.md
139
+ └── dataset.csv
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Installation
145
+
146
+ Clone the repository
147
+
148
+ ```bash
149
+ git clone <repository-url>
150
+ ```
151
+
152
+ Move into the project
153
+
154
+ ```bash
155
+ cd Bank-Customer-Churn-Prediction
156
+ ```
157
+
158
+ Create Virtual Environment
159
+
160
+ ```bash
161
+ python -m venv venv
162
+ ```
163
+
164
+ Activate Virtual Environment
165
+
166
+ ### Windows
167
+
168
+ ```bash
169
+ venv\Scripts\activate
170
+ ```
171
+
172
+ ### Linux / macOS
173
+
174
+ ```bash
175
+ source venv/bin/activate
176
+ ```
177
+
178
+ Install dependencies
179
+
180
+ ```bash
181
+ pip install -r requirements.txt
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Run the Application
187
+
188
+ ```bash
189
+ streamlit run app.py
190
+ ```
191
+
192
+ ---
193
+
194
+ ## How the Prediction Works
195
+
196
+ 1. User enters customer information.
197
+ 2. Input data is converted into numerical format.
198
+ 3. Features are scaled using the saved StandardScaler.
199
+ 4. The trained ANN predicts the probability of customer churn.
200
+ 5. If the probability is greater than **0.5**, the customer is predicted to leave the bank; otherwise, the customer is predicted to stay.
201
+
202
+ ---
203
+
204
+ ## Example Prediction
205
+
206
+ ### Input
207
+
208
+ ```
209
+ Credit Score: 619
210
+ Gender: Female
211
+ Age: 42
212
+ Tenure: 2
213
+ Balance: 0
214
+ Products: 1
215
+ Credit Card: Yes
216
+ Active Member: Yes
217
+ Estimated Salary: 101348.88
218
+ ```
219
+
220
+ ### Output
221
+
222
+ ```
223
+ Prediction Probability: 0.34
224
+
225
+ Customer is likely to Stay.
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Requirements
231
+
232
+ ```
233
+ streamlit
234
+ tensorflow
235
+ numpy
236
+ pandas
237
+ scikit-learn
238
+ joblib
239
+ ```
240
+
241
+ ---
242
+
243
+ ## Future Improvements
244
+
245
+ * Support Geography feature
246
+ * Explain predictions using SHAP
247
+ * Interactive analytics dashboard
248
+ * Batch prediction from CSV
249
+ * REST API using FastAPI
250
+ * Docker deployment
251
+ * Cloud deployment on AWS or Azure
252
+
253
+ ---
254
+
255
+ ## Deployment
256
+
257
+ This project can be deployed on:
258
+
259
+ * Hugging Face Spaces
260
+ * Streamlit Community Cloud
261
+ * Render
262
+ * Railway
263
+ * AWS EC2
264
+ * Microsoft Azure
265
+ * Google Cloud Platform
266
+
267
+ ---
268
+
269
+ ## Author
270
+
271
+ **Sudheer Muthyala**
272
+
273
+ B.Tech – Electronics and Communication Engineering
274
+
275
+ Aspiring Data Scientist | AI & Machine Learning Enthusiast
276
+
277
+ ---
278
+
279
+ ## License
280
+
281
+ This project is intended for educational and portfolio purposes. Feel free to fork, modify, and build upon it while providing appropriate attribution.
282
+