CristopherWVSU commited on
Commit
cb7865d
·
1 Parent(s): bd57f1a

edited the saved models

Browse files
GNB_bank_churn_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2931e17f2a09f58b395b195788a37fed3a9d585740a8cbd7d721deb593f8b1c
3
+ size 2119
bank_churn_model.pkl → LR_bank_churn_model.pkl RENAMED
File without changes
app.py CHANGED
@@ -7,7 +7,7 @@ os.system("pip install -r requirements.txt")
7
 
8
 
9
  # Load the trained model
10
- model = joblib.load("bank_churn_model.pkl")
11
 
12
  # Define categorical mappings
13
  gender_map = {'Male': 0, 'Female': 1}
@@ -25,7 +25,7 @@ st.header("Enter Customer Details")
25
 
26
  customer_age = st.number_input("Enter Customer Age", min_value=1, max_value=100)
27
  gender = st.selectbox("Gender", list(gender_map.keys()))
28
- dependent_count = st.number_input("Number of Dependents (e.g children, spouse, or other family members) (0-5)", min_value=0, max_value=5)
29
  education_level = st.selectbox("Education Level", list(education_level_map.keys()))
30
  marital_status = st.selectbox("Marital Status", list(marital_status_map.keys()))
31
  income_category = st.selectbox("Income Category", list(income_category_map.keys()))
@@ -33,7 +33,7 @@ card_category = st.selectbox("Card Category", list(card_category_map.keys()))
33
  months_on_book = st.number_input("Enter Account Total of Months Active", min_value=0, max_value=100)
34
  total_relationship_count = st.number_input("Total number of accounts or financial products the customer has with the bank ", min_value=0, max_value=100)
35
  months_inactive_12_mon = st.number_input("Enter number of Years account is Inactive", min_value=0, max_value=100)
36
- contacts_count_12_mon = st.number_input("Enter Account Total of Years Inactive", min_value=0, max_value=100)
37
  credit_limit = st.number_input("Enter Maximum Credit Limit", min_value=1, max_value=100000000)
38
  total_revolving_bal = st.number_input("Enter Total Revolving Balance in Account", min_value=0, max_value=100000000)
39
  avg_open_to_buy = st.number_input("Enter Average amount of credit available to the customer on a revolving credit account", min_value=0, max_value=100000000)
 
7
 
8
 
9
  # Load the trained model
10
+ model = joblib.load("LR_bank_churn_model.pkl")
11
 
12
  # Define categorical mappings
13
  gender_map = {'Male': 0, 'Female': 1}
 
25
 
26
  customer_age = st.number_input("Enter Customer Age", min_value=1, max_value=100)
27
  gender = st.selectbox("Gender", list(gender_map.keys()))
28
+ dependent_count = st.number_input("Number of Dependents (e.g children, spouse, or other family members) (0-5)", min_value=0, max_value=10)
29
  education_level = st.selectbox("Education Level", list(education_level_map.keys()))
30
  marital_status = st.selectbox("Marital Status", list(marital_status_map.keys()))
31
  income_category = st.selectbox("Income Category", list(income_category_map.keys()))
 
33
  months_on_book = st.number_input("Enter Account Total of Months Active", min_value=0, max_value=100)
34
  total_relationship_count = st.number_input("Total number of accounts or financial products the customer has with the bank ", min_value=0, max_value=100)
35
  months_inactive_12_mon = st.number_input("Enter number of Years account is Inactive", min_value=0, max_value=100)
36
+ contacts_count_12_mon = st.number_input("Enter Number of Accounts Inactive for Years", min_value=0, max_value=10)
37
  credit_limit = st.number_input("Enter Maximum Credit Limit", min_value=1, max_value=100000000)
38
  total_revolving_bal = st.number_input("Enter Total Revolving Balance in Account", min_value=0, max_value=100000000)
39
  avg_open_to_buy = st.number_input("Enter Average amount of credit available to the customer on a revolving credit account", min_value=0, max_value=100000000)
main.ipynb CHANGED
@@ -15,7 +15,7 @@
15
  },
16
  {
17
  "cell_type": "code",
18
- "execution_count": 159,
19
  "metadata": {},
20
  "outputs": [],
21
  "source": [
@@ -41,7 +41,7 @@
41
  },
42
  {
43
  "cell_type": "code",
44
- "execution_count": 160,
45
  "metadata": {},
46
  "outputs": [],
47
  "source": [
@@ -50,7 +50,7 @@
50
  },
51
  {
52
  "cell_type": "code",
53
- "execution_count": 161,
54
  "metadata": {},
55
  "outputs": [
56
  {
@@ -276,7 +276,7 @@
276
  "[5 rows x 23 columns]"
277
  ]
278
  },
279
- "execution_count": 161,
280
  "metadata": {},
281
  "output_type": "execute_result"
282
  }
@@ -300,7 +300,7 @@
300
  },
301
  {
302
  "cell_type": "code",
303
- "execution_count": 162,
304
  "metadata": {},
305
  "outputs": [],
306
  "source": [
@@ -316,7 +316,7 @@
316
  },
317
  {
318
  "cell_type": "code",
319
- "execution_count": 163,
320
  "metadata": {},
321
  "outputs": [
322
  {
@@ -359,7 +359,7 @@
359
  },
360
  {
361
  "cell_type": "code",
362
- "execution_count": 164,
363
  "metadata": {},
364
  "outputs": [
365
  {
@@ -388,7 +388,7 @@
388
  "dtype: int64"
389
  ]
390
  },
391
- "execution_count": 164,
392
  "metadata": {},
393
  "output_type": "execute_result"
394
  }
@@ -406,7 +406,7 @@
406
  },
407
  {
408
  "cell_type": "code",
409
- "execution_count": 165,
410
  "metadata": {},
411
  "outputs": [],
412
  "source": [
@@ -418,7 +418,7 @@
418
  },
419
  {
420
  "cell_type": "code",
421
- "execution_count": 166,
422
  "metadata": {},
423
  "outputs": [
424
  {
@@ -440,7 +440,7 @@
440
  " 'Avg_Utilization_Ratio']"
441
  ]
442
  },
443
- "execution_count": 166,
444
  "metadata": {},
445
  "output_type": "execute_result"
446
  }
@@ -451,7 +451,7 @@
451
  },
452
  {
453
  "cell_type": "code",
454
- "execution_count": 167,
455
  "metadata": {},
456
  "outputs": [],
457
  "source": [
@@ -469,7 +469,7 @@
469
  },
470
  {
471
  "cell_type": "code",
472
- "execution_count": 168,
473
  "metadata": {},
474
  "outputs": [],
475
  "source": [
@@ -481,7 +481,7 @@
481
  },
482
  {
483
  "cell_type": "code",
484
- "execution_count": 169,
485
  "metadata": {},
486
  "outputs": [
487
  {
@@ -868,7 +868,7 @@
868
  "[10127 rows x 20 columns]"
869
  ]
870
  },
871
- "execution_count": 169,
872
  "metadata": {},
873
  "output_type": "execute_result"
874
  }
@@ -879,7 +879,7 @@
879
  },
880
  {
881
  "cell_type": "code",
882
- "execution_count": 170,
883
  "metadata": {},
884
  "outputs": [
885
  {
@@ -902,7 +902,7 @@
902
  },
903
  {
904
  "cell_type": "code",
905
- "execution_count": 171,
906
  "metadata": {},
907
  "outputs": [
908
  {
@@ -926,7 +926,13 @@
926
  "cell_type": "markdown",
927
  "metadata": {},
928
  "source": [
929
- "A correlation matrix is a powerful tool for understanding the relationships between multiple variables in your dataset. It is particularly important in exploratory data analysis (EDA), machine learning, and statistical modeling. Here's why it's so valuable:"
 
 
 
 
 
 
930
  ]
931
  },
932
  {
@@ -947,7 +953,7 @@
947
  },
948
  {
949
  "cell_type": "code",
950
- "execution_count": 172,
951
  "metadata": {},
952
  "outputs": [],
953
  "source": [
@@ -959,7 +965,7 @@
959
  },
960
  {
961
  "cell_type": "code",
962
- "execution_count": 173,
963
  "metadata": {},
964
  "outputs": [],
965
  "source": [
@@ -969,7 +975,7 @@
969
  },
970
  {
971
  "cell_type": "code",
972
- "execution_count": 174,
973
  "metadata": {},
974
  "outputs": [
975
  {
@@ -1166,7 +1172,7 @@
1166
  "4 816 28 2.500 0.000 "
1167
  ]
1168
  },
1169
- "execution_count": 174,
1170
  "metadata": {},
1171
  "output_type": "execute_result"
1172
  }
@@ -1177,7 +1183,7 @@
1177
  },
1178
  {
1179
  "cell_type": "code",
1180
- "execution_count": 175,
1181
  "metadata": {},
1182
  "outputs": [
1183
  {
@@ -1191,7 +1197,7 @@
1191
  "Name: Attrition_Flag, dtype: int64"
1192
  ]
1193
  },
1194
- "execution_count": 175,
1195
  "metadata": {},
1196
  "output_type": "execute_result"
1197
  }
@@ -1202,7 +1208,7 @@
1202
  },
1203
  {
1204
  "cell_type": "code",
1205
- "execution_count": 176,
1206
  "metadata": {},
1207
  "outputs": [],
1208
  "source": [
@@ -1211,13 +1217,13 @@
1211
  },
1212
  {
1213
  "cell_type": "code",
1214
- "execution_count": 177,
1215
  "metadata": {},
1216
  "outputs": [
1217
  {
1218
  "data": {
1219
  "text/html": [
1220
- "<style>#sk-container-id-11 {\n",
1221
  " /* Definition of color scheme common for light and dark mode */\n",
1222
  " --sklearn-color-text: black;\n",
1223
  " --sklearn-color-line: gray;\n",
@@ -1247,15 +1253,15 @@
1247
  " }\n",
1248
  "}\n",
1249
  "\n",
1250
- "#sk-container-id-11 {\n",
1251
  " color: var(--sklearn-color-text);\n",
1252
  "}\n",
1253
  "\n",
1254
- "#sk-container-id-11 pre {\n",
1255
  " padding: 0;\n",
1256
  "}\n",
1257
  "\n",
1258
- "#sk-container-id-11 input.sk-hidden--visually {\n",
1259
  " border: 0;\n",
1260
  " clip: rect(1px 1px 1px 1px);\n",
1261
  " clip: rect(1px, 1px, 1px, 1px);\n",
@@ -1267,7 +1273,7 @@
1267
  " width: 1px;\n",
1268
  "}\n",
1269
  "\n",
1270
- "#sk-container-id-11 div.sk-dashed-wrapped {\n",
1271
  " border: 1px dashed var(--sklearn-color-line);\n",
1272
  " margin: 0 0.4em 0.5em 0.4em;\n",
1273
  " box-sizing: border-box;\n",
@@ -1275,7 +1281,7 @@
1275
  " background-color: var(--sklearn-color-background);\n",
1276
  "}\n",
1277
  "\n",
1278
- "#sk-container-id-11 div.sk-container {\n",
1279
  " /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
1280
  " but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
1281
  " so we also need the `!important` here to be able to override the\n",
@@ -1285,7 +1291,7 @@
1285
  " position: relative;\n",
1286
  "}\n",
1287
  "\n",
1288
- "#sk-container-id-11 div.sk-text-repr-fallback {\n",
1289
  " display: none;\n",
1290
  "}\n",
1291
  "\n",
@@ -1301,14 +1307,14 @@
1301
  "\n",
1302
  "/* Parallel-specific style estimator block */\n",
1303
  "\n",
1304
- "#sk-container-id-11 div.sk-parallel-item::after {\n",
1305
  " content: \"\";\n",
1306
  " width: 100%;\n",
1307
  " border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
1308
  " flex-grow: 1;\n",
1309
  "}\n",
1310
  "\n",
1311
- "#sk-container-id-11 div.sk-parallel {\n",
1312
  " display: flex;\n",
1313
  " align-items: stretch;\n",
1314
  " justify-content: center;\n",
@@ -1316,28 +1322,28 @@
1316
  " position: relative;\n",
1317
  "}\n",
1318
  "\n",
1319
- "#sk-container-id-11 div.sk-parallel-item {\n",
1320
  " display: flex;\n",
1321
  " flex-direction: column;\n",
1322
  "}\n",
1323
  "\n",
1324
- "#sk-container-id-11 div.sk-parallel-item:first-child::after {\n",
1325
  " align-self: flex-end;\n",
1326
  " width: 50%;\n",
1327
  "}\n",
1328
  "\n",
1329
- "#sk-container-id-11 div.sk-parallel-item:last-child::after {\n",
1330
  " align-self: flex-start;\n",
1331
  " width: 50%;\n",
1332
  "}\n",
1333
  "\n",
1334
- "#sk-container-id-11 div.sk-parallel-item:only-child::after {\n",
1335
  " width: 0;\n",
1336
  "}\n",
1337
  "\n",
1338
  "/* Serial-specific style estimator block */\n",
1339
  "\n",
1340
- "#sk-container-id-11 div.sk-serial {\n",
1341
  " display: flex;\n",
1342
  " flex-direction: column;\n",
1343
  " align-items: center;\n",
@@ -1355,14 +1361,14 @@
1355
  "\n",
1356
  "/* Pipeline and ColumnTransformer style (default) */\n",
1357
  "\n",
1358
- "#sk-container-id-11 div.sk-toggleable {\n",
1359
  " /* Default theme specific background. It is overwritten whether we have a\n",
1360
  " specific estimator or a Pipeline/ColumnTransformer */\n",
1361
  " background-color: var(--sklearn-color-background);\n",
1362
  "}\n",
1363
  "\n",
1364
  "/* Toggleable label */\n",
1365
- "#sk-container-id-11 label.sk-toggleable__label {\n",
1366
  " cursor: pointer;\n",
1367
  " display: block;\n",
1368
  " width: 100%;\n",
@@ -1372,7 +1378,7 @@
1372
  " text-align: center;\n",
1373
  "}\n",
1374
  "\n",
1375
- "#sk-container-id-11 label.sk-toggleable__label-arrow:before {\n",
1376
  " /* Arrow on the left of the label */\n",
1377
  " content: \"▸\";\n",
1378
  " float: left;\n",
@@ -1380,13 +1386,13 @@
1380
  " color: var(--sklearn-color-icon);\n",
1381
  "}\n",
1382
  "\n",
1383
- "#sk-container-id-11 label.sk-toggleable__label-arrow:hover:before {\n",
1384
  " color: var(--sklearn-color-text);\n",
1385
  "}\n",
1386
  "\n",
1387
  "/* Toggleable content - dropdown */\n",
1388
  "\n",
1389
- "#sk-container-id-11 div.sk-toggleable__content {\n",
1390
  " max-height: 0;\n",
1391
  " max-width: 0;\n",
1392
  " overflow: hidden;\n",
@@ -1395,12 +1401,12 @@
1395
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1396
  "}\n",
1397
  "\n",
1398
- "#sk-container-id-11 div.sk-toggleable__content.fitted {\n",
1399
  " /* fitted */\n",
1400
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1401
  "}\n",
1402
  "\n",
1403
- "#sk-container-id-11 div.sk-toggleable__content pre {\n",
1404
  " margin: 0.2em;\n",
1405
  " border-radius: 0.25em;\n",
1406
  " color: var(--sklearn-color-text);\n",
@@ -1408,79 +1414,79 @@
1408
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1409
  "}\n",
1410
  "\n",
1411
- "#sk-container-id-11 div.sk-toggleable__content.fitted pre {\n",
1412
  " /* unfitted */\n",
1413
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1414
  "}\n",
1415
  "\n",
1416
- "#sk-container-id-11 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
1417
  " /* Expand drop-down */\n",
1418
  " max-height: 200px;\n",
1419
  " max-width: 100%;\n",
1420
  " overflow: auto;\n",
1421
  "}\n",
1422
  "\n",
1423
- "#sk-container-id-11 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
1424
  " content: \"▾\";\n",
1425
  "}\n",
1426
  "\n",
1427
  "/* Pipeline/ColumnTransformer-specific style */\n",
1428
  "\n",
1429
- "#sk-container-id-11 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1430
  " color: var(--sklearn-color-text);\n",
1431
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1432
  "}\n",
1433
  "\n",
1434
- "#sk-container-id-11 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1435
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1436
  "}\n",
1437
  "\n",
1438
  "/* Estimator-specific style */\n",
1439
  "\n",
1440
  "/* Colorize estimator box */\n",
1441
- "#sk-container-id-11 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1442
  " /* unfitted */\n",
1443
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1444
  "}\n",
1445
  "\n",
1446
- "#sk-container-id-11 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1447
  " /* fitted */\n",
1448
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1449
  "}\n",
1450
  "\n",
1451
- "#sk-container-id-11 div.sk-label label.sk-toggleable__label,\n",
1452
- "#sk-container-id-11 div.sk-label label {\n",
1453
  " /* The background is the default theme color */\n",
1454
  " color: var(--sklearn-color-text-on-default-background);\n",
1455
  "}\n",
1456
  "\n",
1457
  "/* On hover, darken the color of the background */\n",
1458
- "#sk-container-id-11 div.sk-label:hover label.sk-toggleable__label {\n",
1459
  " color: var(--sklearn-color-text);\n",
1460
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1461
  "}\n",
1462
  "\n",
1463
  "/* Label box, darken color on hover, fitted */\n",
1464
- "#sk-container-id-11 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
1465
  " color: var(--sklearn-color-text);\n",
1466
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1467
  "}\n",
1468
  "\n",
1469
  "/* Estimator label */\n",
1470
  "\n",
1471
- "#sk-container-id-11 div.sk-label label {\n",
1472
  " font-family: monospace;\n",
1473
  " font-weight: bold;\n",
1474
  " display: inline-block;\n",
1475
  " line-height: 1.2em;\n",
1476
  "}\n",
1477
  "\n",
1478
- "#sk-container-id-11 div.sk-label-container {\n",
1479
  " text-align: center;\n",
1480
  "}\n",
1481
  "\n",
1482
  "/* Estimator-specific */\n",
1483
- "#sk-container-id-11 div.sk-estimator {\n",
1484
  " font-family: monospace;\n",
1485
  " border: 1px dotted var(--sklearn-color-border-box);\n",
1486
  " border-radius: 0.25em;\n",
@@ -1490,18 +1496,18 @@
1490
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1491
  "}\n",
1492
  "\n",
1493
- "#sk-container-id-11 div.sk-estimator.fitted {\n",
1494
  " /* fitted */\n",
1495
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1496
  "}\n",
1497
  "\n",
1498
  "/* on hover */\n",
1499
- "#sk-container-id-11 div.sk-estimator:hover {\n",
1500
  " /* unfitted */\n",
1501
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1502
  "}\n",
1503
  "\n",
1504
- "#sk-container-id-11 div.sk-estimator.fitted:hover {\n",
1505
  " /* fitted */\n",
1506
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1507
  "}\n",
@@ -1588,7 +1594,7 @@
1588
  "\n",
1589
  "/* \"?\"-specific style due to the `<a>` HTML tag */\n",
1590
  "\n",
1591
- "#sk-container-id-11 a.estimator_doc_link {\n",
1592
  " float: right;\n",
1593
  " font-size: 1rem;\n",
1594
  " line-height: 1em;\n",
@@ -1603,47 +1609,47 @@
1603
  " border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
1604
  "}\n",
1605
  "\n",
1606
- "#sk-container-id-11 a.estimator_doc_link.fitted {\n",
1607
  " /* fitted */\n",
1608
  " border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
1609
  " color: var(--sklearn-color-fitted-level-1);\n",
1610
  "}\n",
1611
  "\n",
1612
  "/* On hover */\n",
1613
- "#sk-container-id-11 a.estimator_doc_link:hover {\n",
1614
  " /* unfitted */\n",
1615
  " background-color: var(--sklearn-color-unfitted-level-3);\n",
1616
  " color: var(--sklearn-color-background);\n",
1617
  " text-decoration: none;\n",
1618
  "}\n",
1619
  "\n",
1620
- "#sk-container-id-11 a.estimator_doc_link.fitted:hover {\n",
1621
  " /* fitted */\n",
1622
  " background-color: var(--sklearn-color-fitted-level-3);\n",
1623
  "}\n",
1624
- "</style><div id=\"sk-container-id-11\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>GaussianNB()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-11\" type=\"checkbox\" checked><label for=\"sk-estimator-id-11\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;&nbsp;GaussianNB<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.5/modules/generated/sklearn.naive_bayes.GaussianNB.html\">?<span>Documentation for GaussianNB</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>GaussianNB()</pre></div> </div></div></div></div>"
1625
  ],
1626
  "text/plain": [
1627
  "GaussianNB()"
1628
  ]
1629
  },
1630
- "execution_count": 177,
1631
  "metadata": {},
1632
  "output_type": "execute_result"
1633
  }
1634
  ],
1635
  "source": [
1636
- "model = GaussianNB()\n",
1637
- "model.fit(X_train, y_train)"
1638
  ]
1639
  },
1640
  {
1641
  "cell_type": "code",
1642
- "execution_count": 178,
1643
  "metadata": {},
1644
  "outputs": [],
1645
  "source": [
1646
- "y_pred = model.predict(X_test)"
1647
  ]
1648
  },
1649
  {
@@ -1656,7 +1662,7 @@
1656
  },
1657
  {
1658
  "cell_type": "code",
1659
- "execution_count": 179,
1660
  "metadata": {},
1661
  "outputs": [
1662
  {
@@ -1674,7 +1680,7 @@
1674
  },
1675
  {
1676
  "cell_type": "code",
1677
- "execution_count": 180,
1678
  "metadata": {},
1679
  "outputs": [
1680
  {
@@ -1723,6 +1729,24 @@
1723
  "\n"
1724
  ]
1725
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1726
  {
1727
  "cell_type": "markdown",
1728
  "metadata": {},
@@ -1736,7 +1760,7 @@
1736
  },
1737
  {
1738
  "cell_type": "code",
1739
- "execution_count": 181,
1740
  "metadata": {},
1741
  "outputs": [],
1742
  "source": [
@@ -1745,13 +1769,13 @@
1745
  },
1746
  {
1747
  "cell_type": "code",
1748
- "execution_count": 182,
1749
  "metadata": {},
1750
  "outputs": [
1751
  {
1752
  "data": {
1753
  "text/html": [
1754
- "<style>#sk-container-id-12 {\n",
1755
  " /* Definition of color scheme common for light and dark mode */\n",
1756
  " --sklearn-color-text: black;\n",
1757
  " --sklearn-color-line: gray;\n",
@@ -1781,15 +1805,15 @@
1781
  " }\n",
1782
  "}\n",
1783
  "\n",
1784
- "#sk-container-id-12 {\n",
1785
  " color: var(--sklearn-color-text);\n",
1786
  "}\n",
1787
  "\n",
1788
- "#sk-container-id-12 pre {\n",
1789
  " padding: 0;\n",
1790
  "}\n",
1791
  "\n",
1792
- "#sk-container-id-12 input.sk-hidden--visually {\n",
1793
  " border: 0;\n",
1794
  " clip: rect(1px 1px 1px 1px);\n",
1795
  " clip: rect(1px, 1px, 1px, 1px);\n",
@@ -1801,7 +1825,7 @@
1801
  " width: 1px;\n",
1802
  "}\n",
1803
  "\n",
1804
- "#sk-container-id-12 div.sk-dashed-wrapped {\n",
1805
  " border: 1px dashed var(--sklearn-color-line);\n",
1806
  " margin: 0 0.4em 0.5em 0.4em;\n",
1807
  " box-sizing: border-box;\n",
@@ -1809,7 +1833,7 @@
1809
  " background-color: var(--sklearn-color-background);\n",
1810
  "}\n",
1811
  "\n",
1812
- "#sk-container-id-12 div.sk-container {\n",
1813
  " /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
1814
  " but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
1815
  " so we also need the `!important` here to be able to override the\n",
@@ -1819,7 +1843,7 @@
1819
  " position: relative;\n",
1820
  "}\n",
1821
  "\n",
1822
- "#sk-container-id-12 div.sk-text-repr-fallback {\n",
1823
  " display: none;\n",
1824
  "}\n",
1825
  "\n",
@@ -1835,14 +1859,14 @@
1835
  "\n",
1836
  "/* Parallel-specific style estimator block */\n",
1837
  "\n",
1838
- "#sk-container-id-12 div.sk-parallel-item::after {\n",
1839
  " content: \"\";\n",
1840
  " width: 100%;\n",
1841
  " border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
1842
  " flex-grow: 1;\n",
1843
  "}\n",
1844
  "\n",
1845
- "#sk-container-id-12 div.sk-parallel {\n",
1846
  " display: flex;\n",
1847
  " align-items: stretch;\n",
1848
  " justify-content: center;\n",
@@ -1850,28 +1874,28 @@
1850
  " position: relative;\n",
1851
  "}\n",
1852
  "\n",
1853
- "#sk-container-id-12 div.sk-parallel-item {\n",
1854
  " display: flex;\n",
1855
  " flex-direction: column;\n",
1856
  "}\n",
1857
  "\n",
1858
- "#sk-container-id-12 div.sk-parallel-item:first-child::after {\n",
1859
  " align-self: flex-end;\n",
1860
  " width: 50%;\n",
1861
  "}\n",
1862
  "\n",
1863
- "#sk-container-id-12 div.sk-parallel-item:last-child::after {\n",
1864
  " align-self: flex-start;\n",
1865
  " width: 50%;\n",
1866
  "}\n",
1867
  "\n",
1868
- "#sk-container-id-12 div.sk-parallel-item:only-child::after {\n",
1869
  " width: 0;\n",
1870
  "}\n",
1871
  "\n",
1872
  "/* Serial-specific style estimator block */\n",
1873
  "\n",
1874
- "#sk-container-id-12 div.sk-serial {\n",
1875
  " display: flex;\n",
1876
  " flex-direction: column;\n",
1877
  " align-items: center;\n",
@@ -1889,14 +1913,14 @@
1889
  "\n",
1890
  "/* Pipeline and ColumnTransformer style (default) */\n",
1891
  "\n",
1892
- "#sk-container-id-12 div.sk-toggleable {\n",
1893
  " /* Default theme specific background. It is overwritten whether we have a\n",
1894
  " specific estimator or a Pipeline/ColumnTransformer */\n",
1895
  " background-color: var(--sklearn-color-background);\n",
1896
  "}\n",
1897
  "\n",
1898
  "/* Toggleable label */\n",
1899
- "#sk-container-id-12 label.sk-toggleable__label {\n",
1900
  " cursor: pointer;\n",
1901
  " display: block;\n",
1902
  " width: 100%;\n",
@@ -1906,7 +1930,7 @@
1906
  " text-align: center;\n",
1907
  "}\n",
1908
  "\n",
1909
- "#sk-container-id-12 label.sk-toggleable__label-arrow:before {\n",
1910
  " /* Arrow on the left of the label */\n",
1911
  " content: \"▸\";\n",
1912
  " float: left;\n",
@@ -1914,13 +1938,13 @@
1914
  " color: var(--sklearn-color-icon);\n",
1915
  "}\n",
1916
  "\n",
1917
- "#sk-container-id-12 label.sk-toggleable__label-arrow:hover:before {\n",
1918
  " color: var(--sklearn-color-text);\n",
1919
  "}\n",
1920
  "\n",
1921
  "/* Toggleable content - dropdown */\n",
1922
  "\n",
1923
- "#sk-container-id-12 div.sk-toggleable__content {\n",
1924
  " max-height: 0;\n",
1925
  " max-width: 0;\n",
1926
  " overflow: hidden;\n",
@@ -1929,12 +1953,12 @@
1929
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1930
  "}\n",
1931
  "\n",
1932
- "#sk-container-id-12 div.sk-toggleable__content.fitted {\n",
1933
  " /* fitted */\n",
1934
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1935
  "}\n",
1936
  "\n",
1937
- "#sk-container-id-12 div.sk-toggleable__content pre {\n",
1938
  " margin: 0.2em;\n",
1939
  " border-radius: 0.25em;\n",
1940
  " color: var(--sklearn-color-text);\n",
@@ -1942,79 +1966,79 @@
1942
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1943
  "}\n",
1944
  "\n",
1945
- "#sk-container-id-12 div.sk-toggleable__content.fitted pre {\n",
1946
  " /* unfitted */\n",
1947
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1948
  "}\n",
1949
  "\n",
1950
- "#sk-container-id-12 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
1951
  " /* Expand drop-down */\n",
1952
  " max-height: 200px;\n",
1953
  " max-width: 100%;\n",
1954
  " overflow: auto;\n",
1955
  "}\n",
1956
  "\n",
1957
- "#sk-container-id-12 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
1958
  " content: \"▾\";\n",
1959
  "}\n",
1960
  "\n",
1961
  "/* Pipeline/ColumnTransformer-specific style */\n",
1962
  "\n",
1963
- "#sk-container-id-12 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1964
  " color: var(--sklearn-color-text);\n",
1965
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1966
  "}\n",
1967
  "\n",
1968
- "#sk-container-id-12 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1969
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1970
  "}\n",
1971
  "\n",
1972
  "/* Estimator-specific style */\n",
1973
  "\n",
1974
  "/* Colorize estimator box */\n",
1975
- "#sk-container-id-12 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1976
  " /* unfitted */\n",
1977
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1978
  "}\n",
1979
  "\n",
1980
- "#sk-container-id-12 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1981
  " /* fitted */\n",
1982
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1983
  "}\n",
1984
  "\n",
1985
- "#sk-container-id-12 div.sk-label label.sk-toggleable__label,\n",
1986
- "#sk-container-id-12 div.sk-label label {\n",
1987
  " /* The background is the default theme color */\n",
1988
  " color: var(--sklearn-color-text-on-default-background);\n",
1989
  "}\n",
1990
  "\n",
1991
  "/* On hover, darken the color of the background */\n",
1992
- "#sk-container-id-12 div.sk-label:hover label.sk-toggleable__label {\n",
1993
  " color: var(--sklearn-color-text);\n",
1994
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1995
  "}\n",
1996
  "\n",
1997
  "/* Label box, darken color on hover, fitted */\n",
1998
- "#sk-container-id-12 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
1999
  " color: var(--sklearn-color-text);\n",
2000
  " background-color: var(--sklearn-color-fitted-level-2);\n",
2001
  "}\n",
2002
  "\n",
2003
  "/* Estimator label */\n",
2004
  "\n",
2005
- "#sk-container-id-12 div.sk-label label {\n",
2006
  " font-family: monospace;\n",
2007
  " font-weight: bold;\n",
2008
  " display: inline-block;\n",
2009
  " line-height: 1.2em;\n",
2010
  "}\n",
2011
  "\n",
2012
- "#sk-container-id-12 div.sk-label-container {\n",
2013
  " text-align: center;\n",
2014
  "}\n",
2015
  "\n",
2016
  "/* Estimator-specific */\n",
2017
- "#sk-container-id-12 div.sk-estimator {\n",
2018
  " font-family: monospace;\n",
2019
  " border: 1px dotted var(--sklearn-color-border-box);\n",
2020
  " border-radius: 0.25em;\n",
@@ -2024,18 +2048,18 @@
2024
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
2025
  "}\n",
2026
  "\n",
2027
- "#sk-container-id-12 div.sk-estimator.fitted {\n",
2028
  " /* fitted */\n",
2029
  " background-color: var(--sklearn-color-fitted-level-0);\n",
2030
  "}\n",
2031
  "\n",
2032
  "/* on hover */\n",
2033
- "#sk-container-id-12 div.sk-estimator:hover {\n",
2034
  " /* unfitted */\n",
2035
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
2036
  "}\n",
2037
  "\n",
2038
- "#sk-container-id-12 div.sk-estimator.fitted:hover {\n",
2039
  " /* fitted */\n",
2040
  " background-color: var(--sklearn-color-fitted-level-2);\n",
2041
  "}\n",
@@ -2122,7 +2146,7 @@
2122
  "\n",
2123
  "/* \"?\"-specific style due to the `<a>` HTML tag */\n",
2124
  "\n",
2125
- "#sk-container-id-12 a.estimator_doc_link {\n",
2126
  " float: right;\n",
2127
  " font-size: 1rem;\n",
2128
  " line-height: 1em;\n",
@@ -2137,49 +2161,49 @@
2137
  " border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
2138
  "}\n",
2139
  "\n",
2140
- "#sk-container-id-12 a.estimator_doc_link.fitted {\n",
2141
  " /* fitted */\n",
2142
  " border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
2143
  " color: var(--sklearn-color-fitted-level-1);\n",
2144
  "}\n",
2145
  "\n",
2146
  "/* On hover */\n",
2147
- "#sk-container-id-12 a.estimator_doc_link:hover {\n",
2148
  " /* unfitted */\n",
2149
  " background-color: var(--sklearn-color-unfitted-level-3);\n",
2150
  " color: var(--sklearn-color-background);\n",
2151
  " text-decoration: none;\n",
2152
  "}\n",
2153
  "\n",
2154
- "#sk-container-id-12 a.estimator_doc_link.fitted:hover {\n",
2155
  " /* fitted */\n",
2156
  " background-color: var(--sklearn-color-fitted-level-3);\n",
2157
  "}\n",
2158
- "</style><div id=\"sk-container-id-12\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LogisticRegression(max_iter=5250)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-12\" type=\"checkbox\" checked><label for=\"sk-estimator-id-12\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;&nbsp;LogisticRegression<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.LogisticRegression.html\">?<span>Documentation for LogisticRegression</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>LogisticRegression(max_iter=5250)</pre></div> </div></div></div></div>"
2159
  ],
2160
  "text/plain": [
2161
  "LogisticRegression(max_iter=5250)"
2162
  ]
2163
  },
2164
- "execution_count": 182,
2165
  "metadata": {},
2166
  "output_type": "execute_result"
2167
  }
2168
  ],
2169
  "source": [
2170
  "# Initialize and train the model\n",
2171
- "model = LogisticRegression(max_iter=5250) # You can adjust max_iter if needed\n",
2172
- "model.fit(X_train, y_train)"
2173
  ]
2174
  },
2175
  {
2176
  "cell_type": "code",
2177
- "execution_count": 183,
2178
  "metadata": {},
2179
  "outputs": [],
2180
  "source": [
2181
  "# Make predictions\n",
2182
- "y_pred = model.predict(X_test)"
2183
  ]
2184
  },
2185
  {
@@ -2193,7 +2217,7 @@
2193
  },
2194
  {
2195
  "cell_type": "code",
2196
- "execution_count": 184,
2197
  "metadata": {},
2198
  "outputs": [
2199
  {
@@ -2211,7 +2235,7 @@
2211
  },
2212
  {
2213
  "cell_type": "code",
2214
- "execution_count": 185,
2215
  "metadata": {},
2216
  "outputs": [
2217
  {
@@ -2261,6 +2285,15 @@
2261
  "\n"
2262
  ]
2263
  },
 
 
 
 
 
 
 
 
 
2264
  {
2265
  "cell_type": "markdown",
2266
  "metadata": {},
@@ -2272,7 +2305,7 @@
2272
  },
2273
  {
2274
  "cell_type": "code",
2275
- "execution_count": 186,
2276
  "metadata": {},
2277
  "outputs": [
2278
  {
@@ -2284,38 +2317,9 @@
2284
  }
2285
  ],
2286
  "source": [
2287
- "joblib.dump(model, 'bank_churn_model.pkl')\n",
2288
  "print('Model saved')"
2289
  ]
2290
- },
2291
- {
2292
- "cell_type": "code",
2293
- "execution_count": 188,
2294
- "metadata": {},
2295
- "outputs": [
2296
- {
2297
- "data": {
2298
- "text/plain": [
2299
- "array([ 42, 33, 20, 28, 24, 31, 36, 32, 26, 17, 29, 27, 21,\n",
2300
- " 30, 16, 18, 23, 22, 40, 38, 25, 43, 37, 19, 35, 15,\n",
2301
- " 41, 57, 12, 14, 34, 44, 13, 47, 10, 39, 53, 50, 52,\n",
2302
- " 48, 49, 45, 11, 55, 46, 54, 60, 51, 63, 58, 59, 61,\n",
2303
- " 78, 64, 65, 62, 67, 66, 56, 69, 71, 75, 74, 76, 84,\n",
2304
- " 82, 88, 68, 70, 73, 86, 72, 79, 80, 85, 81, 87, 83,\n",
2305
- " 91, 89, 77, 103, 93, 96, 99, 92, 90, 94, 95, 98, 100,\n",
2306
- " 102, 97, 101, 104, 105, 106, 107, 109, 118, 108, 122, 113, 112,\n",
2307
- " 111, 127, 114, 124, 110, 120, 125, 121, 117, 126, 134, 116, 119,\n",
2308
- " 129, 131, 115, 128, 139, 123, 130, 138, 132], dtype=int64)"
2309
- ]
2310
- },
2311
- "execution_count": 188,
2312
- "metadata": {},
2313
- "output_type": "execute_result"
2314
- }
2315
- ],
2316
- "source": [
2317
- "df['Total_Trans_Ct'].unique()"
2318
- ]
2319
  }
2320
  ],
2321
  "metadata": {
 
15
  },
16
  {
17
  "cell_type": "code",
18
+ "execution_count": 1,
19
  "metadata": {},
20
  "outputs": [],
21
  "source": [
 
41
  },
42
  {
43
  "cell_type": "code",
44
+ "execution_count": 2,
45
  "metadata": {},
46
  "outputs": [],
47
  "source": [
 
50
  },
51
  {
52
  "cell_type": "code",
53
+ "execution_count": 3,
54
  "metadata": {},
55
  "outputs": [
56
  {
 
276
  "[5 rows x 23 columns]"
277
  ]
278
  },
279
+ "execution_count": 3,
280
  "metadata": {},
281
  "output_type": "execute_result"
282
  }
 
300
  },
301
  {
302
  "cell_type": "code",
303
+ "execution_count": 4,
304
  "metadata": {},
305
  "outputs": [],
306
  "source": [
 
316
  },
317
  {
318
  "cell_type": "code",
319
+ "execution_count": 5,
320
  "metadata": {},
321
  "outputs": [
322
  {
 
359
  },
360
  {
361
  "cell_type": "code",
362
+ "execution_count": 6,
363
  "metadata": {},
364
  "outputs": [
365
  {
 
388
  "dtype: int64"
389
  ]
390
  },
391
+ "execution_count": 6,
392
  "metadata": {},
393
  "output_type": "execute_result"
394
  }
 
406
  },
407
  {
408
  "cell_type": "code",
409
+ "execution_count": 7,
410
  "metadata": {},
411
  "outputs": [],
412
  "source": [
 
418
  },
419
  {
420
  "cell_type": "code",
421
+ "execution_count": 8,
422
  "metadata": {},
423
  "outputs": [
424
  {
 
440
  " 'Avg_Utilization_Ratio']"
441
  ]
442
  },
443
+ "execution_count": 8,
444
  "metadata": {},
445
  "output_type": "execute_result"
446
  }
 
451
  },
452
  {
453
  "cell_type": "code",
454
+ "execution_count": 9,
455
  "metadata": {},
456
  "outputs": [],
457
  "source": [
 
469
  },
470
  {
471
  "cell_type": "code",
472
+ "execution_count": 10,
473
  "metadata": {},
474
  "outputs": [],
475
  "source": [
 
481
  },
482
  {
483
  "cell_type": "code",
484
+ "execution_count": 11,
485
  "metadata": {},
486
  "outputs": [
487
  {
 
868
  "[10127 rows x 20 columns]"
869
  ]
870
  },
871
+ "execution_count": 11,
872
  "metadata": {},
873
  "output_type": "execute_result"
874
  }
 
879
  },
880
  {
881
  "cell_type": "code",
882
+ "execution_count": 12,
883
  "metadata": {},
884
  "outputs": [
885
  {
 
902
  },
903
  {
904
  "cell_type": "code",
905
+ "execution_count": 13,
906
  "metadata": {},
907
  "outputs": [
908
  {
 
926
  "cell_type": "markdown",
927
  "metadata": {},
928
  "source": [
929
+ "The correlation matrix measures the linear relationship between pairs of variables. The correlation coefficient (ranging from -1 to +1) indicates how strongly two variables are related.\n",
930
+ "\n",
931
+ "+1 indicates a perfect positive correlation (when one variable increases, the other also increases).\n",
932
+ "\n",
933
+ "-1 indicates a perfect negative correlation (when one variable increases, the other decreases).\n",
934
+ "\n",
935
+ "0 indicates no linear correlation."
936
  ]
937
  },
938
  {
 
953
  },
954
  {
955
  "cell_type": "code",
956
+ "execution_count": 14,
957
  "metadata": {},
958
  "outputs": [],
959
  "source": [
 
965
  },
966
  {
967
  "cell_type": "code",
968
+ "execution_count": 15,
969
  "metadata": {},
970
  "outputs": [],
971
  "source": [
 
975
  },
976
  {
977
  "cell_type": "code",
978
+ "execution_count": 16,
979
  "metadata": {},
980
  "outputs": [
981
  {
 
1172
  "4 816 28 2.500 0.000 "
1173
  ]
1174
  },
1175
+ "execution_count": 16,
1176
  "metadata": {},
1177
  "output_type": "execute_result"
1178
  }
 
1183
  },
1184
  {
1185
  "cell_type": "code",
1186
+ "execution_count": 17,
1187
  "metadata": {},
1188
  "outputs": [
1189
  {
 
1197
  "Name: Attrition_Flag, dtype: int64"
1198
  ]
1199
  },
1200
+ "execution_count": 17,
1201
  "metadata": {},
1202
  "output_type": "execute_result"
1203
  }
 
1208
  },
1209
  {
1210
  "cell_type": "code",
1211
+ "execution_count": 18,
1212
  "metadata": {},
1213
  "outputs": [],
1214
  "source": [
 
1217
  },
1218
  {
1219
  "cell_type": "code",
1220
+ "execution_count": 19,
1221
  "metadata": {},
1222
  "outputs": [
1223
  {
1224
  "data": {
1225
  "text/html": [
1226
+ "<style>#sk-container-id-1 {\n",
1227
  " /* Definition of color scheme common for light and dark mode */\n",
1228
  " --sklearn-color-text: black;\n",
1229
  " --sklearn-color-line: gray;\n",
 
1253
  " }\n",
1254
  "}\n",
1255
  "\n",
1256
+ "#sk-container-id-1 {\n",
1257
  " color: var(--sklearn-color-text);\n",
1258
  "}\n",
1259
  "\n",
1260
+ "#sk-container-id-1 pre {\n",
1261
  " padding: 0;\n",
1262
  "}\n",
1263
  "\n",
1264
+ "#sk-container-id-1 input.sk-hidden--visually {\n",
1265
  " border: 0;\n",
1266
  " clip: rect(1px 1px 1px 1px);\n",
1267
  " clip: rect(1px, 1px, 1px, 1px);\n",
 
1273
  " width: 1px;\n",
1274
  "}\n",
1275
  "\n",
1276
+ "#sk-container-id-1 div.sk-dashed-wrapped {\n",
1277
  " border: 1px dashed var(--sklearn-color-line);\n",
1278
  " margin: 0 0.4em 0.5em 0.4em;\n",
1279
  " box-sizing: border-box;\n",
 
1281
  " background-color: var(--sklearn-color-background);\n",
1282
  "}\n",
1283
  "\n",
1284
+ "#sk-container-id-1 div.sk-container {\n",
1285
  " /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
1286
  " but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
1287
  " so we also need the `!important` here to be able to override the\n",
 
1291
  " position: relative;\n",
1292
  "}\n",
1293
  "\n",
1294
+ "#sk-container-id-1 div.sk-text-repr-fallback {\n",
1295
  " display: none;\n",
1296
  "}\n",
1297
  "\n",
 
1307
  "\n",
1308
  "/* Parallel-specific style estimator block */\n",
1309
  "\n",
1310
+ "#sk-container-id-1 div.sk-parallel-item::after {\n",
1311
  " content: \"\";\n",
1312
  " width: 100%;\n",
1313
  " border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
1314
  " flex-grow: 1;\n",
1315
  "}\n",
1316
  "\n",
1317
+ "#sk-container-id-1 div.sk-parallel {\n",
1318
  " display: flex;\n",
1319
  " align-items: stretch;\n",
1320
  " justify-content: center;\n",
 
1322
  " position: relative;\n",
1323
  "}\n",
1324
  "\n",
1325
+ "#sk-container-id-1 div.sk-parallel-item {\n",
1326
  " display: flex;\n",
1327
  " flex-direction: column;\n",
1328
  "}\n",
1329
  "\n",
1330
+ "#sk-container-id-1 div.sk-parallel-item:first-child::after {\n",
1331
  " align-self: flex-end;\n",
1332
  " width: 50%;\n",
1333
  "}\n",
1334
  "\n",
1335
+ "#sk-container-id-1 div.sk-parallel-item:last-child::after {\n",
1336
  " align-self: flex-start;\n",
1337
  " width: 50%;\n",
1338
  "}\n",
1339
  "\n",
1340
+ "#sk-container-id-1 div.sk-parallel-item:only-child::after {\n",
1341
  " width: 0;\n",
1342
  "}\n",
1343
  "\n",
1344
  "/* Serial-specific style estimator block */\n",
1345
  "\n",
1346
+ "#sk-container-id-1 div.sk-serial {\n",
1347
  " display: flex;\n",
1348
  " flex-direction: column;\n",
1349
  " align-items: center;\n",
 
1361
  "\n",
1362
  "/* Pipeline and ColumnTransformer style (default) */\n",
1363
  "\n",
1364
+ "#sk-container-id-1 div.sk-toggleable {\n",
1365
  " /* Default theme specific background. It is overwritten whether we have a\n",
1366
  " specific estimator or a Pipeline/ColumnTransformer */\n",
1367
  " background-color: var(--sklearn-color-background);\n",
1368
  "}\n",
1369
  "\n",
1370
  "/* Toggleable label */\n",
1371
+ "#sk-container-id-1 label.sk-toggleable__label {\n",
1372
  " cursor: pointer;\n",
1373
  " display: block;\n",
1374
  " width: 100%;\n",
 
1378
  " text-align: center;\n",
1379
  "}\n",
1380
  "\n",
1381
+ "#sk-container-id-1 label.sk-toggleable__label-arrow:before {\n",
1382
  " /* Arrow on the left of the label */\n",
1383
  " content: \"▸\";\n",
1384
  " float: left;\n",
 
1386
  " color: var(--sklearn-color-icon);\n",
1387
  "}\n",
1388
  "\n",
1389
+ "#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {\n",
1390
  " color: var(--sklearn-color-text);\n",
1391
  "}\n",
1392
  "\n",
1393
  "/* Toggleable content - dropdown */\n",
1394
  "\n",
1395
+ "#sk-container-id-1 div.sk-toggleable__content {\n",
1396
  " max-height: 0;\n",
1397
  " max-width: 0;\n",
1398
  " overflow: hidden;\n",
 
1401
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1402
  "}\n",
1403
  "\n",
1404
+ "#sk-container-id-1 div.sk-toggleable__content.fitted {\n",
1405
  " /* fitted */\n",
1406
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1407
  "}\n",
1408
  "\n",
1409
+ "#sk-container-id-1 div.sk-toggleable__content pre {\n",
1410
  " margin: 0.2em;\n",
1411
  " border-radius: 0.25em;\n",
1412
  " color: var(--sklearn-color-text);\n",
 
1414
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1415
  "}\n",
1416
  "\n",
1417
+ "#sk-container-id-1 div.sk-toggleable__content.fitted pre {\n",
1418
  " /* unfitted */\n",
1419
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1420
  "}\n",
1421
  "\n",
1422
+ "#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
1423
  " /* Expand drop-down */\n",
1424
  " max-height: 200px;\n",
1425
  " max-width: 100%;\n",
1426
  " overflow: auto;\n",
1427
  "}\n",
1428
  "\n",
1429
+ "#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
1430
  " content: \"▾\";\n",
1431
  "}\n",
1432
  "\n",
1433
  "/* Pipeline/ColumnTransformer-specific style */\n",
1434
  "\n",
1435
+ "#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1436
  " color: var(--sklearn-color-text);\n",
1437
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1438
  "}\n",
1439
  "\n",
1440
+ "#sk-container-id-1 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1441
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1442
  "}\n",
1443
  "\n",
1444
  "/* Estimator-specific style */\n",
1445
  "\n",
1446
  "/* Colorize estimator box */\n",
1447
+ "#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1448
  " /* unfitted */\n",
1449
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1450
  "}\n",
1451
  "\n",
1452
+ "#sk-container-id-1 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1453
  " /* fitted */\n",
1454
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1455
  "}\n",
1456
  "\n",
1457
+ "#sk-container-id-1 div.sk-label label.sk-toggleable__label,\n",
1458
+ "#sk-container-id-1 div.sk-label label {\n",
1459
  " /* The background is the default theme color */\n",
1460
  " color: var(--sklearn-color-text-on-default-background);\n",
1461
  "}\n",
1462
  "\n",
1463
  "/* On hover, darken the color of the background */\n",
1464
+ "#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {\n",
1465
  " color: var(--sklearn-color-text);\n",
1466
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1467
  "}\n",
1468
  "\n",
1469
  "/* Label box, darken color on hover, fitted */\n",
1470
+ "#sk-container-id-1 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
1471
  " color: var(--sklearn-color-text);\n",
1472
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1473
  "}\n",
1474
  "\n",
1475
  "/* Estimator label */\n",
1476
  "\n",
1477
+ "#sk-container-id-1 div.sk-label label {\n",
1478
  " font-family: monospace;\n",
1479
  " font-weight: bold;\n",
1480
  " display: inline-block;\n",
1481
  " line-height: 1.2em;\n",
1482
  "}\n",
1483
  "\n",
1484
+ "#sk-container-id-1 div.sk-label-container {\n",
1485
  " text-align: center;\n",
1486
  "}\n",
1487
  "\n",
1488
  "/* Estimator-specific */\n",
1489
+ "#sk-container-id-1 div.sk-estimator {\n",
1490
  " font-family: monospace;\n",
1491
  " border: 1px dotted var(--sklearn-color-border-box);\n",
1492
  " border-radius: 0.25em;\n",
 
1496
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1497
  "}\n",
1498
  "\n",
1499
+ "#sk-container-id-1 div.sk-estimator.fitted {\n",
1500
  " /* fitted */\n",
1501
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1502
  "}\n",
1503
  "\n",
1504
  "/* on hover */\n",
1505
+ "#sk-container-id-1 div.sk-estimator:hover {\n",
1506
  " /* unfitted */\n",
1507
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1508
  "}\n",
1509
  "\n",
1510
+ "#sk-container-id-1 div.sk-estimator.fitted:hover {\n",
1511
  " /* fitted */\n",
1512
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1513
  "}\n",
 
1594
  "\n",
1595
  "/* \"?\"-specific style due to the `<a>` HTML tag */\n",
1596
  "\n",
1597
+ "#sk-container-id-1 a.estimator_doc_link {\n",
1598
  " float: right;\n",
1599
  " font-size: 1rem;\n",
1600
  " line-height: 1em;\n",
 
1609
  " border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
1610
  "}\n",
1611
  "\n",
1612
+ "#sk-container-id-1 a.estimator_doc_link.fitted {\n",
1613
  " /* fitted */\n",
1614
  " border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
1615
  " color: var(--sklearn-color-fitted-level-1);\n",
1616
  "}\n",
1617
  "\n",
1618
  "/* On hover */\n",
1619
+ "#sk-container-id-1 a.estimator_doc_link:hover {\n",
1620
  " /* unfitted */\n",
1621
  " background-color: var(--sklearn-color-unfitted-level-3);\n",
1622
  " color: var(--sklearn-color-background);\n",
1623
  " text-decoration: none;\n",
1624
  "}\n",
1625
  "\n",
1626
+ "#sk-container-id-1 a.estimator_doc_link.fitted:hover {\n",
1627
  " /* fitted */\n",
1628
  " background-color: var(--sklearn-color-fitted-level-3);\n",
1629
  "}\n",
1630
+ "</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>GaussianNB()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;&nbsp;GaussianNB<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.5/modules/generated/sklearn.naive_bayes.GaussianNB.html\">?<span>Documentation for GaussianNB</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>GaussianNB()</pre></div> </div></div></div></div>"
1631
  ],
1632
  "text/plain": [
1633
  "GaussianNB()"
1634
  ]
1635
  },
1636
+ "execution_count": 19,
1637
  "metadata": {},
1638
  "output_type": "execute_result"
1639
  }
1640
  ],
1641
  "source": [
1642
+ "gaussianNB_model = GaussianNB()\n",
1643
+ "gaussianNB_model.fit(X_train, y_train)"
1644
  ]
1645
  },
1646
  {
1647
  "cell_type": "code",
1648
+ "execution_count": 20,
1649
  "metadata": {},
1650
  "outputs": [],
1651
  "source": [
1652
+ "y_pred = gaussianNB_model.predict(X_test)"
1653
  ]
1654
  },
1655
  {
 
1662
  },
1663
  {
1664
  "cell_type": "code",
1665
+ "execution_count": 21,
1666
  "metadata": {},
1667
  "outputs": [
1668
  {
 
1680
  },
1681
  {
1682
  "cell_type": "code",
1683
+ "execution_count": 22,
1684
  "metadata": {},
1685
  "outputs": [
1686
  {
 
1729
  "\n"
1730
  ]
1731
  },
1732
+ {
1733
+ "cell_type": "code",
1734
+ "execution_count": 23,
1735
+ "metadata": {},
1736
+ "outputs": [
1737
+ {
1738
+ "name": "stdout",
1739
+ "output_type": "stream",
1740
+ "text": [
1741
+ "Model saved\n"
1742
+ ]
1743
+ }
1744
+ ],
1745
+ "source": [
1746
+ "joblib.dump(gaussianNB_model, 'GNB_bank_churn_model.pkl')\n",
1747
+ "print('Model saved')"
1748
+ ]
1749
+ },
1750
  {
1751
  "cell_type": "markdown",
1752
  "metadata": {},
 
1760
  },
1761
  {
1762
  "cell_type": "code",
1763
+ "execution_count": 24,
1764
  "metadata": {},
1765
  "outputs": [],
1766
  "source": [
 
1769
  },
1770
  {
1771
  "cell_type": "code",
1772
+ "execution_count": 25,
1773
  "metadata": {},
1774
  "outputs": [
1775
  {
1776
  "data": {
1777
  "text/html": [
1778
+ "<style>#sk-container-id-2 {\n",
1779
  " /* Definition of color scheme common for light and dark mode */\n",
1780
  " --sklearn-color-text: black;\n",
1781
  " --sklearn-color-line: gray;\n",
 
1805
  " }\n",
1806
  "}\n",
1807
  "\n",
1808
+ "#sk-container-id-2 {\n",
1809
  " color: var(--sklearn-color-text);\n",
1810
  "}\n",
1811
  "\n",
1812
+ "#sk-container-id-2 pre {\n",
1813
  " padding: 0;\n",
1814
  "}\n",
1815
  "\n",
1816
+ "#sk-container-id-2 input.sk-hidden--visually {\n",
1817
  " border: 0;\n",
1818
  " clip: rect(1px 1px 1px 1px);\n",
1819
  " clip: rect(1px, 1px, 1px, 1px);\n",
 
1825
  " width: 1px;\n",
1826
  "}\n",
1827
  "\n",
1828
+ "#sk-container-id-2 div.sk-dashed-wrapped {\n",
1829
  " border: 1px dashed var(--sklearn-color-line);\n",
1830
  " margin: 0 0.4em 0.5em 0.4em;\n",
1831
  " box-sizing: border-box;\n",
 
1833
  " background-color: var(--sklearn-color-background);\n",
1834
  "}\n",
1835
  "\n",
1836
+ "#sk-container-id-2 div.sk-container {\n",
1837
  " /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
1838
  " but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
1839
  " so we also need the `!important` here to be able to override the\n",
 
1843
  " position: relative;\n",
1844
  "}\n",
1845
  "\n",
1846
+ "#sk-container-id-2 div.sk-text-repr-fallback {\n",
1847
  " display: none;\n",
1848
  "}\n",
1849
  "\n",
 
1859
  "\n",
1860
  "/* Parallel-specific style estimator block */\n",
1861
  "\n",
1862
+ "#sk-container-id-2 div.sk-parallel-item::after {\n",
1863
  " content: \"\";\n",
1864
  " width: 100%;\n",
1865
  " border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
1866
  " flex-grow: 1;\n",
1867
  "}\n",
1868
  "\n",
1869
+ "#sk-container-id-2 div.sk-parallel {\n",
1870
  " display: flex;\n",
1871
  " align-items: stretch;\n",
1872
  " justify-content: center;\n",
 
1874
  " position: relative;\n",
1875
  "}\n",
1876
  "\n",
1877
+ "#sk-container-id-2 div.sk-parallel-item {\n",
1878
  " display: flex;\n",
1879
  " flex-direction: column;\n",
1880
  "}\n",
1881
  "\n",
1882
+ "#sk-container-id-2 div.sk-parallel-item:first-child::after {\n",
1883
  " align-self: flex-end;\n",
1884
  " width: 50%;\n",
1885
  "}\n",
1886
  "\n",
1887
+ "#sk-container-id-2 div.sk-parallel-item:last-child::after {\n",
1888
  " align-self: flex-start;\n",
1889
  " width: 50%;\n",
1890
  "}\n",
1891
  "\n",
1892
+ "#sk-container-id-2 div.sk-parallel-item:only-child::after {\n",
1893
  " width: 0;\n",
1894
  "}\n",
1895
  "\n",
1896
  "/* Serial-specific style estimator block */\n",
1897
  "\n",
1898
+ "#sk-container-id-2 div.sk-serial {\n",
1899
  " display: flex;\n",
1900
  " flex-direction: column;\n",
1901
  " align-items: center;\n",
 
1913
  "\n",
1914
  "/* Pipeline and ColumnTransformer style (default) */\n",
1915
  "\n",
1916
+ "#sk-container-id-2 div.sk-toggleable {\n",
1917
  " /* Default theme specific background. It is overwritten whether we have a\n",
1918
  " specific estimator or a Pipeline/ColumnTransformer */\n",
1919
  " background-color: var(--sklearn-color-background);\n",
1920
  "}\n",
1921
  "\n",
1922
  "/* Toggleable label */\n",
1923
+ "#sk-container-id-2 label.sk-toggleable__label {\n",
1924
  " cursor: pointer;\n",
1925
  " display: block;\n",
1926
  " width: 100%;\n",
 
1930
  " text-align: center;\n",
1931
  "}\n",
1932
  "\n",
1933
+ "#sk-container-id-2 label.sk-toggleable__label-arrow:before {\n",
1934
  " /* Arrow on the left of the label */\n",
1935
  " content: \"▸\";\n",
1936
  " float: left;\n",
 
1938
  " color: var(--sklearn-color-icon);\n",
1939
  "}\n",
1940
  "\n",
1941
+ "#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {\n",
1942
  " color: var(--sklearn-color-text);\n",
1943
  "}\n",
1944
  "\n",
1945
  "/* Toggleable content - dropdown */\n",
1946
  "\n",
1947
+ "#sk-container-id-2 div.sk-toggleable__content {\n",
1948
  " max-height: 0;\n",
1949
  " max-width: 0;\n",
1950
  " overflow: hidden;\n",
 
1953
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1954
  "}\n",
1955
  "\n",
1956
+ "#sk-container-id-2 div.sk-toggleable__content.fitted {\n",
1957
  " /* fitted */\n",
1958
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1959
  "}\n",
1960
  "\n",
1961
+ "#sk-container-id-2 div.sk-toggleable__content pre {\n",
1962
  " margin: 0.2em;\n",
1963
  " border-radius: 0.25em;\n",
1964
  " color: var(--sklearn-color-text);\n",
 
1966
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
1967
  "}\n",
1968
  "\n",
1969
+ "#sk-container-id-2 div.sk-toggleable__content.fitted pre {\n",
1970
  " /* unfitted */\n",
1971
  " background-color: var(--sklearn-color-fitted-level-0);\n",
1972
  "}\n",
1973
  "\n",
1974
+ "#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
1975
  " /* Expand drop-down */\n",
1976
  " max-height: 200px;\n",
1977
  " max-width: 100%;\n",
1978
  " overflow: auto;\n",
1979
  "}\n",
1980
  "\n",
1981
+ "#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
1982
  " content: \"▾\";\n",
1983
  "}\n",
1984
  "\n",
1985
  "/* Pipeline/ColumnTransformer-specific style */\n",
1986
  "\n",
1987
+ "#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1988
  " color: var(--sklearn-color-text);\n",
1989
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
1990
  "}\n",
1991
  "\n",
1992
+ "#sk-container-id-2 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
1993
  " background-color: var(--sklearn-color-fitted-level-2);\n",
1994
  "}\n",
1995
  "\n",
1996
  "/* Estimator-specific style */\n",
1997
  "\n",
1998
  "/* Colorize estimator box */\n",
1999
+ "#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
2000
  " /* unfitted */\n",
2001
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
2002
  "}\n",
2003
  "\n",
2004
+ "#sk-container-id-2 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
2005
  " /* fitted */\n",
2006
  " background-color: var(--sklearn-color-fitted-level-2);\n",
2007
  "}\n",
2008
  "\n",
2009
+ "#sk-container-id-2 div.sk-label label.sk-toggleable__label,\n",
2010
+ "#sk-container-id-2 div.sk-label label {\n",
2011
  " /* The background is the default theme color */\n",
2012
  " color: var(--sklearn-color-text-on-default-background);\n",
2013
  "}\n",
2014
  "\n",
2015
  "/* On hover, darken the color of the background */\n",
2016
+ "#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {\n",
2017
  " color: var(--sklearn-color-text);\n",
2018
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
2019
  "}\n",
2020
  "\n",
2021
  "/* Label box, darken color on hover, fitted */\n",
2022
+ "#sk-container-id-2 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
2023
  " color: var(--sklearn-color-text);\n",
2024
  " background-color: var(--sklearn-color-fitted-level-2);\n",
2025
  "}\n",
2026
  "\n",
2027
  "/* Estimator label */\n",
2028
  "\n",
2029
+ "#sk-container-id-2 div.sk-label label {\n",
2030
  " font-family: monospace;\n",
2031
  " font-weight: bold;\n",
2032
  " display: inline-block;\n",
2033
  " line-height: 1.2em;\n",
2034
  "}\n",
2035
  "\n",
2036
+ "#sk-container-id-2 div.sk-label-container {\n",
2037
  " text-align: center;\n",
2038
  "}\n",
2039
  "\n",
2040
  "/* Estimator-specific */\n",
2041
+ "#sk-container-id-2 div.sk-estimator {\n",
2042
  " font-family: monospace;\n",
2043
  " border: 1px dotted var(--sklearn-color-border-box);\n",
2044
  " border-radius: 0.25em;\n",
 
2048
  " background-color: var(--sklearn-color-unfitted-level-0);\n",
2049
  "}\n",
2050
  "\n",
2051
+ "#sk-container-id-2 div.sk-estimator.fitted {\n",
2052
  " /* fitted */\n",
2053
  " background-color: var(--sklearn-color-fitted-level-0);\n",
2054
  "}\n",
2055
  "\n",
2056
  "/* on hover */\n",
2057
+ "#sk-container-id-2 div.sk-estimator:hover {\n",
2058
  " /* unfitted */\n",
2059
  " background-color: var(--sklearn-color-unfitted-level-2);\n",
2060
  "}\n",
2061
  "\n",
2062
+ "#sk-container-id-2 div.sk-estimator.fitted:hover {\n",
2063
  " /* fitted */\n",
2064
  " background-color: var(--sklearn-color-fitted-level-2);\n",
2065
  "}\n",
 
2146
  "\n",
2147
  "/* \"?\"-specific style due to the `<a>` HTML tag */\n",
2148
  "\n",
2149
+ "#sk-container-id-2 a.estimator_doc_link {\n",
2150
  " float: right;\n",
2151
  " font-size: 1rem;\n",
2152
  " line-height: 1em;\n",
 
2161
  " border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
2162
  "}\n",
2163
  "\n",
2164
+ "#sk-container-id-2 a.estimator_doc_link.fitted {\n",
2165
  " /* fitted */\n",
2166
  " border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
2167
  " color: var(--sklearn-color-fitted-level-1);\n",
2168
  "}\n",
2169
  "\n",
2170
  "/* On hover */\n",
2171
+ "#sk-container-id-2 a.estimator_doc_link:hover {\n",
2172
  " /* unfitted */\n",
2173
  " background-color: var(--sklearn-color-unfitted-level-3);\n",
2174
  " color: var(--sklearn-color-background);\n",
2175
  " text-decoration: none;\n",
2176
  "}\n",
2177
  "\n",
2178
+ "#sk-container-id-2 a.estimator_doc_link.fitted:hover {\n",
2179
  " /* fitted */\n",
2180
  " background-color: var(--sklearn-color-fitted-level-3);\n",
2181
  "}\n",
2182
+ "</style><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LogisticRegression(max_iter=5250)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" checked><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;&nbsp;LogisticRegression<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.LogisticRegression.html\">?<span>Documentation for LogisticRegression</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>LogisticRegression(max_iter=5250)</pre></div> </div></div></div></div>"
2183
  ],
2184
  "text/plain": [
2185
  "LogisticRegression(max_iter=5250)"
2186
  ]
2187
  },
2188
+ "execution_count": 25,
2189
  "metadata": {},
2190
  "output_type": "execute_result"
2191
  }
2192
  ],
2193
  "source": [
2194
  "# Initialize and train the model\n",
2195
+ "LogisticRegression_model = LogisticRegression(max_iter=5250) # You can adjust max_iter if needed\n",
2196
+ "LogisticRegression_model.fit(X_train, y_train)"
2197
  ]
2198
  },
2199
  {
2200
  "cell_type": "code",
2201
+ "execution_count": 26,
2202
  "metadata": {},
2203
  "outputs": [],
2204
  "source": [
2205
  "# Make predictions\n",
2206
+ "y_pred = LogisticRegression_model.predict(X_test)"
2207
  ]
2208
  },
2209
  {
 
2217
  },
2218
  {
2219
  "cell_type": "code",
2220
+ "execution_count": 27,
2221
  "metadata": {},
2222
  "outputs": [
2223
  {
 
2235
  },
2236
  {
2237
  "cell_type": "code",
2238
+ "execution_count": 28,
2239
  "metadata": {},
2240
  "outputs": [
2241
  {
 
2285
  "\n"
2286
  ]
2287
  },
2288
+ {
2289
+ "cell_type": "code",
2290
+ "execution_count": null,
2291
+ "metadata": {},
2292
+ "outputs": [],
2293
+ "source": [
2294
+ "df['Contacts_Count_12_mon'].unique()"
2295
+ ]
2296
+ },
2297
  {
2298
  "cell_type": "markdown",
2299
  "metadata": {},
 
2305
  },
2306
  {
2307
  "cell_type": "code",
2308
+ "execution_count": 29,
2309
  "metadata": {},
2310
  "outputs": [
2311
  {
 
2317
  }
2318
  ],
2319
  "source": [
2320
+ "joblib.dump(LogisticRegression_model, 'LR_bank_churn_model.pkl')\n",
2321
  "print('Model saved')"
2322
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2323
  }
2324
  ],
2325
  "metadata": {