File size: 78,706 Bytes
5d45e2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h1> ----- PIPELINE NOTEBOOK ----- </h1>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from sklearn.pipeline import Pipeline\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.preprocessing import OneHotEncoder\n",
    "from xgboost import XGBRegressor\n",
    "\n",
    "from sklearn.compose import ColumnTransformer\n",
    "\n",
    "from sklearn import set_config"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>Store</th>\n",
       "      <th>DayOfWeek</th>\n",
       "      <th>Date</th>\n",
       "      <th>Sales</th>\n",
       "      <th>Customers</th>\n",
       "      <th>Promo</th>\n",
       "      <th>StateHoliday</th>\n",
       "      <th>SchoolHoliday</th>\n",
       "      <th>StoreType</th>\n",
       "      <th>Assortment</th>\n",
       "      <th>CompetitionDistance</th>\n",
       "      <th>CompetitionOpenSinceMonth</th>\n",
       "      <th>CompetitionOpenSinceYear</th>\n",
       "      <th>Promo2</th>\n",
       "      <th>Promo2SinceWeek</th>\n",
       "      <th>Promo2SinceYear</th>\n",
       "      <th>PromoInterval</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>5</td>\n",
       "      <td>2015-07-31</td>\n",
       "      <td>5263</td>\n",
       "      <td>555</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Large Store</td>\n",
       "      <td>basic</td>\n",
       "      <td>1270</td>\n",
       "      <td>9</td>\n",
       "      <td>2008</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>5</td>\n",
       "      <td>2015-07-31</td>\n",
       "      <td>6064</td>\n",
       "      <td>625</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>570</td>\n",
       "      <td>11</td>\n",
       "      <td>2007</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>2010</td>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>2015-07-31</td>\n",
       "      <td>8314</td>\n",
       "      <td>821</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>14130</td>\n",
       "      <td>12</td>\n",
       "      <td>2006</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>2011</td>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>2015-07-31</td>\n",
       "      <td>13995</td>\n",
       "      <td>1498</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Large Store</td>\n",
       "      <td>extended</td>\n",
       "      <td>620</td>\n",
       "      <td>9</td>\n",
       "      <td>2009</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>2015-07-31</td>\n",
       "      <td>4822</td>\n",
       "      <td>559</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>29910</td>\n",
       "      <td>4</td>\n",
       "      <td>2015</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Unnamed: 0  Store  DayOfWeek        Date  Sales  Customers  Promo  \\\n",
       "0           0      1          5  2015-07-31   5263        555      1   \n",
       "1           1      2          5  2015-07-31   6064        625      1   \n",
       "2           2      3          5  2015-07-31   8314        821      1   \n",
       "3           3      4          5  2015-07-31  13995       1498      1   \n",
       "4           4      5          5  2015-07-31   4822        559      1   \n",
       "\n",
       "   StateHoliday  SchoolHoliday    StoreType Assortment  CompetitionDistance  \\\n",
       "0             0              1  Large Store      basic                 1270   \n",
       "1             0              1   Small Shop      basic                  570   \n",
       "2             0              1   Small Shop      basic                14130   \n",
       "3             0              1  Large Store   extended                  620   \n",
       "4             0              1   Small Shop      basic                29910   \n",
       "\n",
       "   CompetitionOpenSinceMonth  CompetitionOpenSinceYear  Promo2  \\\n",
       "0                          9                      2008       0   \n",
       "1                         11                      2007       1   \n",
       "2                         12                      2006       1   \n",
       "3                          9                      2009       0   \n",
       "4                          4                      2015       0   \n",
       "\n",
       "   Promo2SinceWeek  Promo2SinceYear    PromoInterval  \n",
       "0                0                0                0  \n",
       "1               13             2010  Jan,Apr,Jul,Oct  \n",
       "2               14             2011  Jan,Apr,Jul,Oct  \n",
       "3                0                0                0  \n",
       "4                0                0                0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(r\"../Dataset/Rossmann_Cleaned_data.csv\")\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PromoInterval</th>\n",
       "      <th>StoreType</th>\n",
       "      <th>Assortment</th>\n",
       "      <th>StateHoliday</th>\n",
       "      <th>Store</th>\n",
       "      <th>Customers</th>\n",
       "      <th>Promo</th>\n",
       "      <th>SchoolHoliday</th>\n",
       "      <th>CompetitionDistance</th>\n",
       "      <th>CompetitionOpenSinceMonth</th>\n",
       "      <th>CompetitionOpenSinceYear</th>\n",
       "      <th>Sales</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>Large Store</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>555</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1270</td>\n",
       "      <td>9</td>\n",
       "      <td>2008</td>\n",
       "      <td>5263</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>625</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>570</td>\n",
       "      <td>11</td>\n",
       "      <td>2007</td>\n",
       "      <td>6064</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>821</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>14130</td>\n",
       "      <td>12</td>\n",
       "      <td>2006</td>\n",
       "      <td>8314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>Large Store</td>\n",
       "      <td>extended</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>1498</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>620</td>\n",
       "      <td>9</td>\n",
       "      <td>2009</td>\n",
       "      <td>13995</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>559</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>29910</td>\n",
       "      <td>4</td>\n",
       "      <td>2015</td>\n",
       "      <td>4822</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     PromoInterval    StoreType Assortment  StateHoliday  Store  Customers  \\\n",
       "0                0  Large Store      basic             0      1        555   \n",
       "1  Jan,Apr,Jul,Oct   Small Shop      basic             0      2        625   \n",
       "2  Jan,Apr,Jul,Oct   Small Shop      basic             0      3        821   \n",
       "3                0  Large Store   extended             0      4       1498   \n",
       "4                0   Small Shop      basic             0      5        559   \n",
       "\n",
       "   Promo  SchoolHoliday  CompetitionDistance  CompetitionOpenSinceMonth  \\\n",
       "0      1              1                 1270                          9   \n",
       "1      1              1                  570                         11   \n",
       "2      1              1                14130                         12   \n",
       "3      1              1                  620                          9   \n",
       "4      1              1                29910                          4   \n",
       "\n",
       "   CompetitionOpenSinceYear  Sales  \n",
       "0                      2008   5263  \n",
       "1                      2007   6064  \n",
       "2                      2006   8314  \n",
       "3                      2009  13995  \n",
       "4                      2015   4822  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = df[[\"PromoInterval\",\"StoreType\",\"Assortment\",\"StateHoliday\",\"Store\",\"Customers\",\"Promo\",\"SchoolHoliday\",\"CompetitionDistance\",\"CompetitionOpenSinceMonth\",\"CompetitionOpenSinceYear\",\"Sales\"]]\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "8\n",
      "7388\n"
     ]
    }
   ],
   "source": [
    "print(df[\"Customers\"].min())\n",
    "print(df[\"Customers\"].max())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 844338 entries, 0 to 844337\n",
      "Data columns (total 12 columns):\n",
      " #   Column                     Non-Null Count   Dtype \n",
      "---  ------                     --------------   ----- \n",
      " 0   PromoInterval              844338 non-null  object\n",
      " 1   StoreType                  844338 non-null  object\n",
      " 2   Assortment                 844338 non-null  object\n",
      " 3   StateHoliday               844338 non-null  int64 \n",
      " 4   Store                      844338 non-null  int64 \n",
      " 5   Customers                  844338 non-null  int64 \n",
      " 6   Promo                      844338 non-null  int64 \n",
      " 7   SchoolHoliday              844338 non-null  int64 \n",
      " 8   CompetitionDistance        844338 non-null  int64 \n",
      " 9   CompetitionOpenSinceMonth  844338 non-null  int64 \n",
      " 10  CompetitionOpenSinceYear   844338 non-null  int64 \n",
      " 11  Sales                      844338 non-null  int64 \n",
      "dtypes: int64(9), object(3)\n",
      "memory usage: 77.3+ MB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(844338, 12)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Unique values in PromoInterval: ['0' 'Jan,Apr,Jul,Oct' 'Feb,May,Aug,Nov' 'Mar,Jun,Sept,Dec']\n",
      "Unique values in StoreType: ['Large Store' 'Small Shop' 'Hypermarket' 'Medium Store']\n",
      "Unique values in Assortment: ['basic' 'extended' 'extra']\n",
      "Unique values in StateHoliday: [0 1]\n",
      "Unique values in Store: [   1    2    3 ... 1115  876  292]\n",
      "Unique values in Customers: [ 555  625  821 ... 3900   36 4065]\n",
      "Unique values in Promo: [1 0]\n",
      "Unique values in SchoolHoliday: [1 0]\n",
      "Unique values in CompetitionDistance: [ 1270   570 14130   620 29910   310 24000  7520  2030  3160   960  1070\n",
      "  1300  4110  3270    50 13840  3240  2340   550  1040  4060  4590   430\n",
      "  2300    60  1200  2170    40  9800  2910  1320  2240  7660   540  4230\n",
      "  1090   260   180  1180   290  4880  9710   270  1060 18010  6260 10570\n",
      "   450 30360  7170   720  6620   420  7340  2840  5540   350  2050  3700\n",
      " 22560   410   250  1130  4840 17500  2200  1650   330 22440 19960  3510\n",
      "  3320  7910  2370 22390  2710 11810  1870   480   560 10690  2380  2410\n",
      "   240 16690 14620  1890  8780  8980 15140 17930  2440   150  5210   390\n",
      "  6190  1390  1930  2190  3300 46590  7890  1630 20930  4510  5740   680\n",
      "  3450  3580  2100  2290  3570 58260 16760  1410   760  3370  1350  2000\n",
      "  2460   900   920  5190  1730 25360  1700  1540  2930 16570   280  8050\n",
      "  8540  2090  2610 31830  4360  1780 16240 16420  3050  2020  2950 11840\n",
      "  8530 17110  2970  5340  1480  1160  3720   100   140 12540   980  2640\n",
      "   110 13090  4130  3770  1250  1710  5800 12610  9670  3560  1860 19360\n",
      "   850  5760  1470  1100  2770   520 16970   220  3850  4210  6360 20260\n",
      "  5140   490  5630   380  6870   300 11680   970 15050  4030  8650   190\n",
      "  3150   640  1640  1000 13530  2920  7930 10180 10800 17410  6680  3840\n",
      " 13570  4370  5710  1420   320   610  1110   780  6880   710  1310  4660\n",
      "    70   340  3520 22330  4630    80 27190   210 15340  1140  4580   360\n",
      "  4520  1450 16180  8480  3640  2960  7840  9260  2320 18640  6970  1220\n",
      "  2260  1290  1460  2740   800  6540  4150  2325  9580 19840 38630   120\n",
      " 15430  1950  2470  5100 18660  8740 11300 14160 38710  9000  3140 32330\n",
      "  8140  8400 13140 10070  3130   370   670  1840  4040    90 10600  1590\n",
      "  2280  8080 15770 18650  8090  9360 16490  1490  8880  5290  1500  9720\n",
      "  8970  2060  2890  2040  4490 13620  6470  5870  8250  1970 11120  1150\n",
      " 15710   160  2140  6630  1800 26130   130  6690  1600   460  2120  4820\n",
      " 10850  3620 23130  5360  9200  5830  4970  1080  8240  5890  1560   840\n",
      "  8460  4460  6210  6910  4650  1620  3530  2880 16350 12870   810 30030\n",
      " 13020   910  3900  2530   500 11400  1510  3970  5780  1850 75860 26450\n",
      "  3390 34050  1790 44320  4160 10890  3110 20390  5260  5300  5030 14810\n",
      "  8300   770  1940  7470  2550  2310 14300  2180 14960   660  4680  1740\n",
      "  1260  5470  2780  1610   990 13080   820  9070  1280  4740  8260   590\n",
      "   400 11260    20 22490  3330  2510  6900 18610  7160 40860 20620 12920\n",
      " 18160  5950  4700   600   650  7280  5020   580  8990  3760  2330  4260\n",
      "  3040  3000  3910  1910  1210   700  1010  4270  1340  2110  9230  1190\n",
      "  4400  2270 12700 20970   170  7250  1360   440 15720  3340  2540 33060\n",
      " 17340  8220 10950 10310 18370  2070  2490   730  8940  9910  5440    30\n",
      "  4080  6920  1170 10740   510  1690  2870  3350 11640 27530  9790 10170\n",
      "  7780  8040   530   230  7420  2130 14570   200  6930  7860  1680  2700\n",
      " 17080 15170  3250  4140  2850 20050 18760 15040  3030  3780   830  8550\n",
      "  7830  2900 11470  4870 12070  3200  8190 15320  3590  5650  5900 17540\n",
      " 40540 13990 15270 35280   860  1920  5980  6400 11900  4380  6710  1370\n",
      " 17650  4330 45740  3410  8670 13130 19780  2390 32240 26490 25430  9820\n",
      "  2630 20640 16990   630  5390 15490  3210  1530  9770 17280  5090  7180\n",
      "  9560 48330  1760 24770  3870 18620 12770  9640  2590 24530 16210 17570\n",
      "  7980  3290  6320  5070  3470  2720 14600  6890 27650  8860  5000  1120\n",
      "   940 14040  4770  3440  3020  6270 21770   740 21370  1020  9680 21810\n",
      " 10620  3860 29190  4570  7550 12430 19700  4450 18670 19370 18540  3920\n",
      "  3170  7290  1980 12480  3100  7240 18710  2620  6420   470  5150 15700\n",
      "  5460 22350  2810  2820  6860 18020  1670  2220  1430   870  6300 19830\n",
      "  9430 23620  9630  4180  3890  4420 21930  2480  3460  6560  5840  2230\n",
      " 19640  6480  4610  6330  1520  3740  1990 36410  7680 13750 27150 17290\n",
      " 26990 29070  3750 13170  5080 13190  5350  3230  3380  3430  8110  6250\n",
      " 12020  5010 18050  5380 16680 11540  2210  4300  5220  9990 10450   690\n",
      "  1830  5330  1400  3490  1900  1880 21790]\n",
      "Unique values in CompetitionOpenSinceMonth: [ 9 11 12  4 10  8  3  6  5  1  2  7]\n",
      "Unique values in CompetitionOpenSinceYear: [2008 2007 2006 2009 2015 2013 2014 2000 2011 2010 2005 1999 2003 2012\n",
      " 2004 2002 1961 1995 2001 1990 1994 1900 1998]\n",
      "Unique values in Sales: [ 5263  6064  8314 ...   660 17815 23303]\n"
     ]
    }
   ],
   "source": [
    "def print_unique_values(dataframe):\n",
    "    for column in dataframe.columns:\n",
    "        unique_values = dataframe[column].unique()\n",
    "        print(f\"Unique values in {column}: {unique_values}\")\n",
    "\n",
    "# Example usage:\n",
    "print_unique_values(df)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = df.drop(columns = [\"Sales\"])\n",
    "y = df[\"Sales\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Train Test Split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((633253, 11), (211085, 11), (633253,), (211085,))"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X,y, test_size=0.25, random_state=42)\n",
    "\n",
    "# Checking the shape after spliting\n",
    "X_train.shape, X_test.shape, y_train.shape, y_test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PromoInterval</th>\n",
       "      <th>StoreType</th>\n",
       "      <th>Assortment</th>\n",
       "      <th>StateHoliday</th>\n",
       "      <th>Store</th>\n",
       "      <th>Customers</th>\n",
       "      <th>Promo</th>\n",
       "      <th>SchoolHoliday</th>\n",
       "      <th>CompetitionDistance</th>\n",
       "      <th>CompetitionOpenSinceMonth</th>\n",
       "      <th>CompetitionOpenSinceYear</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>795018</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>650</td>\n",
       "      <td>636</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1420</td>\n",
       "      <td>10</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>463276</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>72</td>\n",
       "      <td>261</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2200</td>\n",
       "      <td>12</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268352</th>\n",
       "      <td>0</td>\n",
       "      <td>Medium Store</td>\n",
       "      <td>extra</td>\n",
       "      <td>0</td>\n",
       "      <td>733</td>\n",
       "      <td>3567</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>860</td>\n",
       "      <td>10</td>\n",
       "      <td>1999</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67308</th>\n",
       "      <td>0</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>extended</td>\n",
       "      <td>0</td>\n",
       "      <td>796</td>\n",
       "      <td>791</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7180</td>\n",
       "      <td>11</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>482458</th>\n",
       "      <td>0</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>extended</td>\n",
       "      <td>0</td>\n",
       "      <td>301</td>\n",
       "      <td>480</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4510</td>\n",
       "      <td>3</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>259178</th>\n",
       "      <td>Feb,May,Aug,Nov</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>1013</td>\n",
       "      <td>217</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>630</td>\n",
       "      <td>2</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>365838</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>extended</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>1394</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>960</td>\n",
       "      <td>11</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>131932</th>\n",
       "      <td>0</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>376</td>\n",
       "      <td>796</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>160</td>\n",
       "      <td>8</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>671155</th>\n",
       "      <td>0</td>\n",
       "      <td>Hypermarket</td>\n",
       "      <td>extended</td>\n",
       "      <td>0</td>\n",
       "      <td>76</td>\n",
       "      <td>885</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>19960</td>\n",
       "      <td>3</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>121958</th>\n",
       "      <td>Feb,May,Aug,Nov</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>446</td>\n",
       "      <td>684</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>340</td>\n",
       "      <td>10</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>633253 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          PromoInterval     StoreType Assortment  StateHoliday  Store  \\\n",
       "795018  Jan,Apr,Jul,Oct    Small Shop      basic             0    650   \n",
       "463276  Jan,Apr,Jul,Oct    Small Shop      basic             0     72   \n",
       "268352                0  Medium Store      extra             0    733   \n",
       "67308                 0    Small Shop   extended             0    796   \n",
       "482458                0    Small Shop   extended             0    301   \n",
       "...                 ...           ...        ...           ...    ...   \n",
       "259178  Feb,May,Aug,Nov    Small Shop      basic             0   1013   \n",
       "365838  Jan,Apr,Jul,Oct    Small Shop   extended             0     11   \n",
       "131932                0    Small Shop      basic             0    376   \n",
       "671155                0   Hypermarket   extended             0     76   \n",
       "121958  Feb,May,Aug,Nov    Small Shop      basic             0    446   \n",
       "\n",
       "        Customers  Promo  SchoolHoliday  CompetitionDistance  \\\n",
       "795018        636      1              0                 1420   \n",
       "463276        261      0              0                 2200   \n",
       "268352       3567      1              0                  860   \n",
       "67308         791      1              0                 7180   \n",
       "482458        480      0              0                 4510   \n",
       "...           ...    ...            ...                  ...   \n",
       "259178        217      0              0                  630   \n",
       "365838       1394      1              0                  960   \n",
       "131932        796      0              0                  160   \n",
       "671155        885      0              0                19960   \n",
       "121958        684      1              0                  340   \n",
       "\n",
       "        CompetitionOpenSinceMonth  CompetitionOpenSinceYear  \n",
       "795018                         10                      2012  \n",
       "463276                         12                      2009  \n",
       "268352                         10                      1999  \n",
       "67308                          11                      2012  \n",
       "482458                          3                      2015  \n",
       "...                           ...                       ...  \n",
       "259178                          2                      2015  \n",
       "365838                         11                      2011  \n",
       "131932                          8                      2012  \n",
       "671155                          3                      2006  \n",
       "121958                         10                      2000  \n",
       "\n",
       "[633253 rows x 11 columns]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PromoInterval\n",
       "0                   423292\n",
       "Jan,Apr,Jul,Oct     242397\n",
       "Feb,May,Aug,Nov      97998\n",
       "Mar,Jun,Sept,Dec     80651\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"PromoInterval\"].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pipeline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>#sk-container-id-1 {\n",
       "  /* Definition of color scheme common for light and dark mode */\n",
       "  --sklearn-color-text: black;\n",
       "  --sklearn-color-line: gray;\n",
       "  /* Definition of color scheme for unfitted estimators */\n",
       "  --sklearn-color-unfitted-level-0: #fff5e6;\n",
       "  --sklearn-color-unfitted-level-1: #f6e4d2;\n",
       "  --sklearn-color-unfitted-level-2: #ffe0b3;\n",
       "  --sklearn-color-unfitted-level-3: chocolate;\n",
       "  /* Definition of color scheme for fitted estimators */\n",
       "  --sklearn-color-fitted-level-0: #f0f8ff;\n",
       "  --sklearn-color-fitted-level-1: #d4ebff;\n",
       "  --sklearn-color-fitted-level-2: #b3dbfd;\n",
       "  --sklearn-color-fitted-level-3: cornflowerblue;\n",
       "\n",
       "  /* Specific color for light theme */\n",
       "  --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
       "  --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, white)));\n",
       "  --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, black)));\n",
       "  --sklearn-color-icon: #696969;\n",
       "\n",
       "  @media (prefers-color-scheme: dark) {\n",
       "    /* Redefinition of color scheme for dark theme */\n",
       "    --sklearn-color-text-on-default-background: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
       "    --sklearn-color-background: var(--sg-background-color, var(--theme-background, var(--jp-layout-color0, #111)));\n",
       "    --sklearn-color-border-box: var(--sg-text-color, var(--theme-code-foreground, var(--jp-content-font-color1, white)));\n",
       "    --sklearn-color-icon: #878787;\n",
       "  }\n",
       "}\n",
       "\n",
       "#sk-container-id-1 {\n",
       "  color: var(--sklearn-color-text);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 pre {\n",
       "  padding: 0;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 input.sk-hidden--visually {\n",
       "  border: 0;\n",
       "  clip: rect(1px 1px 1px 1px);\n",
       "  clip: rect(1px, 1px, 1px, 1px);\n",
       "  height: 1px;\n",
       "  margin: -1px;\n",
       "  overflow: hidden;\n",
       "  padding: 0;\n",
       "  position: absolute;\n",
       "  width: 1px;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-dashed-wrapped {\n",
       "  border: 1px dashed var(--sklearn-color-line);\n",
       "  margin: 0 0.4em 0.5em 0.4em;\n",
       "  box-sizing: border-box;\n",
       "  padding-bottom: 0.4em;\n",
       "  background-color: var(--sklearn-color-background);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-container {\n",
       "  /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
       "     but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
       "     so we also need the `!important` here to be able to override the\n",
       "     default hidden behavior on the sphinx rendered scikit-learn.org.\n",
       "     See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n",
       "  display: inline-block !important;\n",
       "  position: relative;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-text-repr-fallback {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       "div.sk-parallel-item,\n",
       "div.sk-serial,\n",
       "div.sk-item {\n",
       "  /* draw centered vertical line to link estimators */\n",
       "  background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n",
       "  background-size: 2px 100%;\n",
       "  background-repeat: no-repeat;\n",
       "  background-position: center center;\n",
       "}\n",
       "\n",
       "/* Parallel-specific style estimator block */\n",
       "\n",
       "#sk-container-id-1 div.sk-parallel-item::after {\n",
       "  content: \"\";\n",
       "  width: 100%;\n",
       "  border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
       "  flex-grow: 1;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-parallel {\n",
       "  display: flex;\n",
       "  align-items: stretch;\n",
       "  justify-content: center;\n",
       "  background-color: var(--sklearn-color-background);\n",
       "  position: relative;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-parallel-item {\n",
       "  display: flex;\n",
       "  flex-direction: column;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-parallel-item:first-child::after {\n",
       "  align-self: flex-end;\n",
       "  width: 50%;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-parallel-item:last-child::after {\n",
       "  align-self: flex-start;\n",
       "  width: 50%;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-parallel-item:only-child::after {\n",
       "  width: 0;\n",
       "}\n",
       "\n",
       "/* Serial-specific style estimator block */\n",
       "\n",
       "#sk-container-id-1 div.sk-serial {\n",
       "  display: flex;\n",
       "  flex-direction: column;\n",
       "  align-items: center;\n",
       "  background-color: var(--sklearn-color-background);\n",
       "  padding-right: 1em;\n",
       "  padding-left: 1em;\n",
       "}\n",
       "\n",
       "\n",
       "/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\n",
       "clickable and can be expanded/collapsed.\n",
       "- Pipeline and ColumnTransformer use this feature and define the default style\n",
       "- Estimators will overwrite some part of the style using the `sk-estimator` class\n",
       "*/\n",
       "\n",
       "/* Pipeline and ColumnTransformer style (default) */\n",
       "\n",
       "#sk-container-id-1 div.sk-toggleable {\n",
       "  /* Default theme specific background. It is overwritten whether we have a\n",
       "  specific estimator or a Pipeline/ColumnTransformer */\n",
       "  background-color: var(--sklearn-color-background);\n",
       "}\n",
       "\n",
       "/* Toggleable label */\n",
       "#sk-container-id-1 label.sk-toggleable__label {\n",
       "  cursor: pointer;\n",
       "  display: block;\n",
       "  width: 100%;\n",
       "  margin-bottom: 0;\n",
       "  padding: 0.5em;\n",
       "  box-sizing: border-box;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 label.sk-toggleable__label-arrow:before {\n",
       "  /* Arrow on the left of the label */\n",
       "  content: \"\";\n",
       "  float: left;\n",
       "  margin-right: 0.25em;\n",
       "  color: var(--sklearn-color-icon);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {\n",
       "  color: var(--sklearn-color-text);\n",
       "}\n",
       "\n",
       "/* Toggleable content - dropdown */\n",
       "\n",
       "#sk-container-id-1 div.sk-toggleable__content {\n",
       "  max-height: 0;\n",
       "  max-width: 0;\n",
       "  overflow: hidden;\n",
       "  text-align: left;\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-unfitted-level-0);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-toggleable__content.fitted {\n",
       "  /* fitted */\n",
       "  background-color: var(--sklearn-color-fitted-level-0);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-toggleable__content pre {\n",
       "  margin: 0.2em;\n",
       "  border-radius: 0.25em;\n",
       "  color: var(--sklearn-color-text);\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-unfitted-level-0);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-toggleable__content.fitted pre {\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-fitted-level-0);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
       "  /* Expand drop-down */\n",
       "  max-height: 200px;\n",
       "  max-width: 100%;\n",
       "  overflow: auto;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
       "  content: \"\";\n",
       "}\n",
       "\n",
       "/* Pipeline/ColumnTransformer-specific style */\n",
       "\n",
       "#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
       "  color: var(--sklearn-color-text);\n",
       "  background-color: var(--sklearn-color-unfitted-level-2);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
       "  background-color: var(--sklearn-color-fitted-level-2);\n",
       "}\n",
       "\n",
       "/* Estimator-specific style */\n",
       "\n",
       "/* Colorize estimator box */\n",
       "#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-unfitted-level-2);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
       "  /* fitted */\n",
       "  background-color: var(--sklearn-color-fitted-level-2);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-label label.sk-toggleable__label,\n",
       "#sk-container-id-1 div.sk-label label {\n",
       "  /* The background is the default theme color */\n",
       "  color: var(--sklearn-color-text-on-default-background);\n",
       "}\n",
       "\n",
       "/* On hover, darken the color of the background */\n",
       "#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {\n",
       "  color: var(--sklearn-color-text);\n",
       "  background-color: var(--sklearn-color-unfitted-level-2);\n",
       "}\n",
       "\n",
       "/* Label box, darken color on hover, fitted */\n",
       "#sk-container-id-1 div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
       "  color: var(--sklearn-color-text);\n",
       "  background-color: var(--sklearn-color-fitted-level-2);\n",
       "}\n",
       "\n",
       "/* Estimator label */\n",
       "\n",
       "#sk-container-id-1 div.sk-label label {\n",
       "  font-family: monospace;\n",
       "  font-weight: bold;\n",
       "  display: inline-block;\n",
       "  line-height: 1.2em;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-label-container {\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       "/* Estimator-specific */\n",
       "#sk-container-id-1 div.sk-estimator {\n",
       "  font-family: monospace;\n",
       "  border: 1px dotted var(--sklearn-color-border-box);\n",
       "  border-radius: 0.25em;\n",
       "  box-sizing: border-box;\n",
       "  margin-bottom: 0.5em;\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-unfitted-level-0);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-estimator.fitted {\n",
       "  /* fitted */\n",
       "  background-color: var(--sklearn-color-fitted-level-0);\n",
       "}\n",
       "\n",
       "/* on hover */\n",
       "#sk-container-id-1 div.sk-estimator:hover {\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-unfitted-level-2);\n",
       "}\n",
       "\n",
       "#sk-container-id-1 div.sk-estimator.fitted:hover {\n",
       "  /* fitted */\n",
       "  background-color: var(--sklearn-color-fitted-level-2);\n",
       "}\n",
       "\n",
       "/* Specification for estimator info (e.g. \"i\" and \"?\") */\n",
       "\n",
       "/* Common style for \"i\" and \"?\" */\n",
       "\n",
       ".sk-estimator-doc-link,\n",
       "a:link.sk-estimator-doc-link,\n",
       "a:visited.sk-estimator-doc-link {\n",
       "  float: right;\n",
       "  font-size: smaller;\n",
       "  line-height: 1em;\n",
       "  font-family: monospace;\n",
       "  background-color: var(--sklearn-color-background);\n",
       "  border-radius: 1em;\n",
       "  height: 1em;\n",
       "  width: 1em;\n",
       "  text-decoration: none !important;\n",
       "  margin-left: 1ex;\n",
       "  /* unfitted */\n",
       "  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
       "  color: var(--sklearn-color-unfitted-level-1);\n",
       "}\n",
       "\n",
       ".sk-estimator-doc-link.fitted,\n",
       "a:link.sk-estimator-doc-link.fitted,\n",
       "a:visited.sk-estimator-doc-link.fitted {\n",
       "  /* fitted */\n",
       "  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
       "  color: var(--sklearn-color-fitted-level-1);\n",
       "}\n",
       "\n",
       "/* On hover */\n",
       "div.sk-estimator:hover .sk-estimator-doc-link:hover,\n",
       ".sk-estimator-doc-link:hover,\n",
       "div.sk-label-container:hover .sk-estimator-doc-link:hover,\n",
       ".sk-estimator-doc-link:hover {\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-unfitted-level-3);\n",
       "  color: var(--sklearn-color-background);\n",
       "  text-decoration: none;\n",
       "}\n",
       "\n",
       "div.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n",
       ".sk-estimator-doc-link.fitted:hover,\n",
       "div.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n",
       ".sk-estimator-doc-link.fitted:hover {\n",
       "  /* fitted */\n",
       "  background-color: var(--sklearn-color-fitted-level-3);\n",
       "  color: var(--sklearn-color-background);\n",
       "  text-decoration: none;\n",
       "}\n",
       "\n",
       "/* Span, style for the box shown on hovering the info icon */\n",
       ".sk-estimator-doc-link span {\n",
       "  display: none;\n",
       "  z-index: 9999;\n",
       "  position: relative;\n",
       "  font-weight: normal;\n",
       "  right: .2ex;\n",
       "  padding: .5ex;\n",
       "  margin: .5ex;\n",
       "  width: min-content;\n",
       "  min-width: 20ex;\n",
       "  max-width: 50ex;\n",
       "  color: var(--sklearn-color-text);\n",
       "  box-shadow: 2pt 2pt 4pt #999;\n",
       "  /* unfitted */\n",
       "  background: var(--sklearn-color-unfitted-level-0);\n",
       "  border: .5pt solid var(--sklearn-color-unfitted-level-3);\n",
       "}\n",
       "\n",
       ".sk-estimator-doc-link.fitted span {\n",
       "  /* fitted */\n",
       "  background: var(--sklearn-color-fitted-level-0);\n",
       "  border: var(--sklearn-color-fitted-level-3);\n",
       "}\n",
       "\n",
       ".sk-estimator-doc-link:hover span {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       "/* \"?\"-specific style due to the `<a>` HTML tag */\n",
       "\n",
       "#sk-container-id-1 a.estimator_doc_link {\n",
       "  float: right;\n",
       "  font-size: 1rem;\n",
       "  line-height: 1em;\n",
       "  font-family: monospace;\n",
       "  background-color: var(--sklearn-color-background);\n",
       "  border-radius: 1rem;\n",
       "  height: 1rem;\n",
       "  width: 1rem;\n",
       "  text-decoration: none;\n",
       "  /* unfitted */\n",
       "  color: var(--sklearn-color-unfitted-level-1);\n",
       "  border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 a.estimator_doc_link.fitted {\n",
       "  /* fitted */\n",
       "  border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
       "  color: var(--sklearn-color-fitted-level-1);\n",
       "}\n",
       "\n",
       "/* On hover */\n",
       "#sk-container-id-1 a.estimator_doc_link:hover {\n",
       "  /* unfitted */\n",
       "  background-color: var(--sklearn-color-unfitted-level-3);\n",
       "  color: var(--sklearn-color-background);\n",
       "  text-decoration: none;\n",
       "}\n",
       "\n",
       "#sk-container-id-1 a.estimator_doc_link.fitted:hover {\n",
       "  /* fitted */\n",
       "  background-color: var(--sklearn-color-fitted-level-3);\n",
       "}\n",
       "</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>Pipeline(steps=[(&#x27;encoding&#x27;,\n",
       "                 ColumnTransformer(remainder=&#x27;passthrough&#x27;,\n",
       "                                   transformers=[(&#x27;ohe&#x27;,\n",
       "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
       "                                                  [&#x27;PromoInterval&#x27;, &#x27;StoreType&#x27;,\n",
       "                                                   &#x27;Assortment&#x27;])])),\n",
       "                (&#x27;scaler&#x27;, StandardScaler()),\n",
       "                (&#x27;model&#x27;,\n",
       "                 XGBRegressor(base_score=None, booster=None, callbacks=None,\n",
       "                              colsample_bylevel=None, colsample_bynode=None,\n",
       "                              colsample_bytree=None, device=None,...\n",
       "                              feature_types=None, gamma=None, grow_policy=None,\n",
       "                              importance_type=None,\n",
       "                              interaction_constraints=None, learning_rate=0.1,\n",
       "                              max_bin=None, max_cat_threshold=None,\n",
       "                              max_cat_to_onehot=None, max_delta_step=None,\n",
       "                              max_depth=13, max_leaves=None,\n",
       "                              min_child_weight=None, missing=nan,\n",
       "                              monotone_constraints=None, multi_strategy=None,\n",
       "                              n_estimators=None, n_jobs=None,\n",
       "                              num_parallel_tree=None, random_state=None, ...))])</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 sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" ><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;&nbsp;Pipeline<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.4/modules/generated/sklearn.pipeline.Pipeline.html\">?<span>Documentation for Pipeline</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>Pipeline(steps=[(&#x27;encoding&#x27;,\n",
       "                 ColumnTransformer(remainder=&#x27;passthrough&#x27;,\n",
       "                                   transformers=[(&#x27;ohe&#x27;,\n",
       "                                                  OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
       "                                                  [&#x27;PromoInterval&#x27;, &#x27;StoreType&#x27;,\n",
       "                                                   &#x27;Assortment&#x27;])])),\n",
       "                (&#x27;scaler&#x27;, StandardScaler()),\n",
       "                (&#x27;model&#x27;,\n",
       "                 XGBRegressor(base_score=None, booster=None, callbacks=None,\n",
       "                              colsample_bylevel=None, colsample_bynode=None,\n",
       "                              colsample_bytree=None, device=None,...\n",
       "                              feature_types=None, gamma=None, grow_policy=None,\n",
       "                              importance_type=None,\n",
       "                              interaction_constraints=None, learning_rate=0.1,\n",
       "                              max_bin=None, max_cat_threshold=None,\n",
       "                              max_cat_to_onehot=None, max_delta_step=None,\n",
       "                              max_depth=13, max_leaves=None,\n",
       "                              min_child_weight=None, missing=nan,\n",
       "                              monotone_constraints=None, multi_strategy=None,\n",
       "                              n_estimators=None, n_jobs=None,\n",
       "                              num_parallel_tree=None, random_state=None, ...))])</pre></div> </div></div><div class=\"sk-serial\"><div class=\"sk-item sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" ><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;encoding: ColumnTransformer<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.4/modules/generated/sklearn.compose.ColumnTransformer.html\">?<span>Documentation for encoding: ColumnTransformer</span></a></label><div class=\"sk-toggleable__content fitted\"><pre>ColumnTransformer(remainder=&#x27;passthrough&#x27;,\n",
       "                  transformers=[(&#x27;ohe&#x27;, OneHotEncoder(handle_unknown=&#x27;ignore&#x27;),\n",
       "                                 [&#x27;PromoInterval&#x27;, &#x27;StoreType&#x27;, &#x27;Assortment&#x27;])])</pre></div> </div></div><div class=\"sk-parallel\"><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-3\" type=\"checkbox\" ><label for=\"sk-estimator-id-3\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">ohe</label><div class=\"sk-toggleable__content fitted\"><pre>[&#x27;PromoInterval&#x27;, &#x27;StoreType&#x27;, &#x27;Assortment&#x27;]</pre></div> </div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-4\" type=\"checkbox\" ><label for=\"sk-estimator-id-4\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;OneHotEncoder<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.4/modules/generated/sklearn.preprocessing.OneHotEncoder.html\">?<span>Documentation for OneHotEncoder</span></a></label><div class=\"sk-toggleable__content fitted\"><pre>OneHotEncoder(handle_unknown=&#x27;ignore&#x27;)</pre></div> </div></div></div></div></div><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-5\" type=\"checkbox\" ><label for=\"sk-estimator-id-5\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">remainder</label><div class=\"sk-toggleable__content fitted\"><pre>[&#x27;StateHoliday&#x27;, &#x27;Store&#x27;, &#x27;Customers&#x27;, &#x27;Promo&#x27;, &#x27;SchoolHoliday&#x27;, &#x27;CompetitionDistance&#x27;, &#x27;CompetitionOpenSinceMonth&#x27;, &#x27;CompetitionOpenSinceYear&#x27;]</pre></div> </div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-6\" type=\"checkbox\" ><label for=\"sk-estimator-id-6\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">passthrough</label><div class=\"sk-toggleable__content fitted\"><pre>passthrough</pre></div> </div></div></div></div></div></div></div><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-7\" type=\"checkbox\" ><label for=\"sk-estimator-id-7\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;StandardScaler<a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.4/modules/generated/sklearn.preprocessing.StandardScaler.html\">?<span>Documentation for StandardScaler</span></a></label><div class=\"sk-toggleable__content fitted\"><pre>StandardScaler()</pre></div> </div></div><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-8\" type=\"checkbox\" ><label for=\"sk-estimator-id-8\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">XGBRegressor</label><div class=\"sk-toggleable__content fitted\"><pre>XGBRegressor(base_score=None, booster=None, callbacks=None,\n",
       "             colsample_bylevel=None, colsample_bynode=None,\n",
       "             colsample_bytree=None, device=None, early_stopping_rounds=None,\n",
       "             enable_categorical=False, eval_metric=None, feature_types=None,\n",
       "             gamma=None, grow_policy=None, importance_type=None,\n",
       "             interaction_constraints=None, learning_rate=0.1, max_bin=None,\n",
       "             max_cat_threshold=None, max_cat_to_onehot=None,\n",
       "             max_delta_step=None, max_depth=13, max_leaves=None,\n",
       "             min_child_weight=None, missing=nan, monotone_constraints=None,\n",
       "             multi_strategy=None, n_estimators=None, n_jobs=None,\n",
       "             num_parallel_tree=None, random_state=None, ...)</pre></div> </div></div></div></div></div></div>"
      ],
      "text/plain": [
       "Pipeline(steps=[('encoding',\n",
       "                 ColumnTransformer(remainder='passthrough',\n",
       "                                   transformers=[('ohe',\n",
       "                                                  OneHotEncoder(handle_unknown='ignore'),\n",
       "                                                  ['PromoInterval', 'StoreType',\n",
       "                                                   'Assortment'])])),\n",
       "                ('scaler', StandardScaler()),\n",
       "                ('model',\n",
       "                 XGBRegressor(base_score=None, booster=None, callbacks=None,\n",
       "                              colsample_bylevel=None, colsample_bynode=None,\n",
       "                              colsample_bytree=None, device=None,...\n",
       "                              feature_types=None, gamma=None, grow_policy=None,\n",
       "                              importance_type=None,\n",
       "                              interaction_constraints=None, learning_rate=0.1,\n",
       "                              max_bin=None, max_cat_threshold=None,\n",
       "                              max_cat_to_onehot=None, max_delta_step=None,\n",
       "                              max_depth=13, max_leaves=None,\n",
       "                              min_child_weight=None, missing=nan,\n",
       "                              monotone_constraints=None, multi_strategy=None,\n",
       "                              n_estimators=None, n_jobs=None,\n",
       "                              num_parallel_tree=None, random_state=None, ...))])"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Define the ColumnTransformer\n",
    "ohe_col = [\"PromoInterval\", \"StoreType\", \"Assortment\"]\n",
    "\n",
    "ct_encoding = ColumnTransformer(\n",
    "    transformers=[\n",
    "        (\"ohe\", OneHotEncoder(handle_unknown=\"ignore\"), ohe_col)\n",
    "    ],\n",
    "    remainder=\"passthrough\"\n",
    ")\n",
    "\n",
    "\n",
    "# Define the XGBRegressor model\n",
    "model = XGBRegressor(learning_rate=0.1, max_depth=13)\n",
    "\n",
    "# Define the pipeline\n",
    "pipe = Pipeline(steps=[\n",
    "    (\"encoding\", ct_encoding),\n",
    "    (\"scaler\", StandardScaler()),\n",
    "    (\"model\", model)\n",
    "])\n",
    "\n",
    "# Now you can fit your pipeline with your data\n",
    "pipe.fit(X_train, y_train)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([5674.2217, 7922.6377, 9180.126 , ..., 7287.449 , 3228.0945,\n",
       "       4453.9897], dtype=float32)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_pred = pipe.predict(X_test)\n",
    "y_pred"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "43879      5934\n",
       "562681     7800\n",
       "239643     9111\n",
       "689976     7831\n",
       "397240    10046\n",
       "          ...  \n",
       "512864    13692\n",
       "750784     6958\n",
       "192729     6785\n",
       "755727     2925\n",
       "604917     4178\n",
       "Name: Sales, Length: 211085, dtype: int64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['PromoInterval', 'StoreType', 'Assortment', 'StateHoliday', 'Store',\n",
       "       'Customers', 'Promo', 'SchoolHoliday', 'CompetitionDistance',\n",
       "       'CompetitionOpenSinceMonth', 'CompetitionOpenSinceYear'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PromoInterval</th>\n",
       "      <th>StoreType</th>\n",
       "      <th>Assortment</th>\n",
       "      <th>StateHoliday</th>\n",
       "      <th>Store</th>\n",
       "      <th>Customers</th>\n",
       "      <th>Promo</th>\n",
       "      <th>SchoolHoliday</th>\n",
       "      <th>CompetitionDistance</th>\n",
       "      <th>CompetitionOpenSinceMonth</th>\n",
       "      <th>CompetitionOpenSinceYear</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>795018</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>650</td>\n",
       "      <td>636</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1420</td>\n",
       "      <td>10</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>463276</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>72</td>\n",
       "      <td>261</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2200</td>\n",
       "      <td>12</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>268352</th>\n",
       "      <td>0</td>\n",
       "      <td>Medium Store</td>\n",
       "      <td>extra</td>\n",
       "      <td>0</td>\n",
       "      <td>733</td>\n",
       "      <td>3567</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>860</td>\n",
       "      <td>10</td>\n",
       "      <td>1999</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67308</th>\n",
       "      <td>0</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>extended</td>\n",
       "      <td>0</td>\n",
       "      <td>796</td>\n",
       "      <td>791</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7180</td>\n",
       "      <td>11</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>482458</th>\n",
       "      <td>0</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>extended</td>\n",
       "      <td>0</td>\n",
       "      <td>301</td>\n",
       "      <td>480</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4510</td>\n",
       "      <td>3</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          PromoInterval     StoreType Assortment  StateHoliday  Store  \\\n",
       "795018  Jan,Apr,Jul,Oct    Small Shop      basic             0    650   \n",
       "463276  Jan,Apr,Jul,Oct    Small Shop      basic             0     72   \n",
       "268352                0  Medium Store      extra             0    733   \n",
       "67308                 0    Small Shop   extended             0    796   \n",
       "482458                0    Small Shop   extended             0    301   \n",
       "\n",
       "        Customers  Promo  SchoolHoliday  CompetitionDistance  \\\n",
       "795018        636      1              0                 1420   \n",
       "463276        261      0              0                 2200   \n",
       "268352       3567      1              0                  860   \n",
       "67308         791      1              0                 7180   \n",
       "482458        480      0              0                 4510   \n",
       "\n",
       "        CompetitionOpenSinceMonth  CompetitionOpenSinceYear  \n",
       "795018                         10                      2012  \n",
       "463276                         12                      2009  \n",
       "268352                         10                      1999  \n",
       "67308                          11                      2012  \n",
       "482458                          3                      2015  "
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PromoInterval</th>\n",
       "      <th>StoreType</th>\n",
       "      <th>Assortment</th>\n",
       "      <th>StateHoliday</th>\n",
       "      <th>Store</th>\n",
       "      <th>Customers</th>\n",
       "      <th>Promo</th>\n",
       "      <th>SchoolHoliday</th>\n",
       "      <th>CompetitionDistance</th>\n",
       "      <th>CompetitionOpenSinceMonth</th>\n",
       "      <th>CompetitionOpenSinceYear</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Jan,Apr,Jul,Oct</td>\n",
       "      <td>Small Shop</td>\n",
       "      <td>basic</td>\n",
       "      <td>0</td>\n",
       "      <td>650</td>\n",
       "      <td>636</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1420</td>\n",
       "      <td>10</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     PromoInterval   StoreType Assortment StateHoliday Store Customers Promo  \\\n",
       "0  Jan,Apr,Jul,Oct  Small Shop      basic            0   650       636     1   \n",
       "\n",
       "  SchoolHoliday CompetitionDistance CompetitionOpenSinceMonth  \\\n",
       "0             0                1420                        10   \n",
       "\n",
       "  CompetitionOpenSinceYear  \n",
       "0                     2012  "
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 795018\n",
    "temp_df = pd.DataFrame(data =  [[\"Jan,Apr,Jul,Oct\",\"Small Shop\",\"basic\",\"0\",\"650\",\"636\",\"1\",\"0\",\"1420\",\"10\",\"2012\"]], columns = X_test.columns)\n",
    "temp_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([6357.158], dtype=float32)"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pipe.predict(temp_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Record at index 795018:\n",
      "PromoInterval                Jan,Apr,Jul,Oct\n",
      "StoreType                         Small Shop\n",
      "Assortment                             basic\n",
      "StateHoliday                               0\n",
      "Store                                    650\n",
      "Customers                                636\n",
      "Promo                                      1\n",
      "SchoolHoliday                              0\n",
      "CompetitionDistance                     1420\n",
      "CompetitionOpenSinceMonth                 10\n",
      "CompetitionOpenSinceYear                2012\n",
      "Sales                                   6322\n",
      "Name: 795018, dtype: object\n"
     ]
    }
   ],
   "source": [
    "# Assuming your DataFrame is named df\n",
    "record = df.iloc[795018]\n",
    "\n",
    "print(\"Record at index 795018:\")\n",
    "print(record)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Unique values in PromoInterval: ['0' 'Jan,Apr,Jul,Oct' 'Feb,May,Aug,Nov' 'Mar,Jun,Sept,Dec']\n",
      "Unique values in StoreType: ['Large Store' 'Small Shop' 'Hypermarket' 'Medium Store']\n",
      "Unique values in Assortment: ['basic' 'extended' 'extra']\n",
      "Unique values in StateHoliday: [0 1]\n",
      "Unique values in Store: [   1    2    3 ... 1115  876  292]\n",
      "Unique values in Customers: [ 555  625  821 ... 3900   36 4065]\n",
      "Unique values in Promo: [1 0]\n",
      "Unique values in SchoolHoliday: [1 0]\n",
      "Unique values in CompetitionDistance: [ 1270   570 14130   620 29910   310 24000  7520  2030  3160   960  1070\n",
      "  1300  4110  3270    50 13840  3240  2340   550  1040  4060  4590   430\n",
      "  2300    60  1200  2170    40  9800  2910  1320  2240  7660   540  4230\n",
      "  1090   260   180  1180   290  4880  9710   270  1060 18010  6260 10570\n",
      "   450 30360  7170   720  6620   420  7340  2840  5540   350  2050  3700\n",
      " 22560   410   250  1130  4840 17500  2200  1650   330 22440 19960  3510\n",
      "  3320  7910  2370 22390  2710 11810  1870   480   560 10690  2380  2410\n",
      "   240 16690 14620  1890  8780  8980 15140 17930  2440   150  5210   390\n",
      "  6190  1390  1930  2190  3300 46590  7890  1630 20930  4510  5740   680\n",
      "  3450  3580  2100  2290  3570 58260 16760  1410   760  3370  1350  2000\n",
      "  2460   900   920  5190  1730 25360  1700  1540  2930 16570   280  8050\n",
      "  8540  2090  2610 31830  4360  1780 16240 16420  3050  2020  2950 11840\n",
      "  8530 17110  2970  5340  1480  1160  3720   100   140 12540   980  2640\n",
      "   110 13090  4130  3770  1250  1710  5800 12610  9670  3560  1860 19360\n",
      "   850  5760  1470  1100  2770   520 16970   220  3850  4210  6360 20260\n",
      "  5140   490  5630   380  6870   300 11680   970 15050  4030  8650   190\n",
      "  3150   640  1640  1000 13530  2920  7930 10180 10800 17410  6680  3840\n",
      " 13570  4370  5710  1420   320   610  1110   780  6880   710  1310  4660\n",
      "    70   340  3520 22330  4630    80 27190   210 15340  1140  4580   360\n",
      "  4520  1450 16180  8480  3640  2960  7840  9260  2320 18640  6970  1220\n",
      "  2260  1290  1460  2740   800  6540  4150  2325  9580 19840 38630   120\n",
      " 15430  1950  2470  5100 18660  8740 11300 14160 38710  9000  3140 32330\n",
      "  8140  8400 13140 10070  3130   370   670  1840  4040    90 10600  1590\n",
      "  2280  8080 15770 18650  8090  9360 16490  1490  8880  5290  1500  9720\n",
      "  8970  2060  2890  2040  4490 13620  6470  5870  8250  1970 11120  1150\n",
      " 15710   160  2140  6630  1800 26130   130  6690  1600   460  2120  4820\n",
      " 10850  3620 23130  5360  9200  5830  4970  1080  8240  5890  1560   840\n",
      "  8460  4460  6210  6910  4650  1620  3530  2880 16350 12870   810 30030\n",
      " 13020   910  3900  2530   500 11400  1510  3970  5780  1850 75860 26450\n",
      "  3390 34050  1790 44320  4160 10890  3110 20390  5260  5300  5030 14810\n",
      "  8300   770  1940  7470  2550  2310 14300  2180 14960   660  4680  1740\n",
      "  1260  5470  2780  1610   990 13080   820  9070  1280  4740  8260   590\n",
      "   400 11260    20 22490  3330  2510  6900 18610  7160 40860 20620 12920\n",
      " 18160  5950  4700   600   650  7280  5020   580  8990  3760  2330  4260\n",
      "  3040  3000  3910  1910  1210   700  1010  4270  1340  2110  9230  1190\n",
      "  4400  2270 12700 20970   170  7250  1360   440 15720  3340  2540 33060\n",
      " 17340  8220 10950 10310 18370  2070  2490   730  8940  9910  5440    30\n",
      "  4080  6920  1170 10740   510  1690  2870  3350 11640 27530  9790 10170\n",
      "  7780  8040   530   230  7420  2130 14570   200  6930  7860  1680  2700\n",
      " 17080 15170  3250  4140  2850 20050 18760 15040  3030  3780   830  8550\n",
      "  7830  2900 11470  4870 12070  3200  8190 15320  3590  5650  5900 17540\n",
      " 40540 13990 15270 35280   860  1920  5980  6400 11900  4380  6710  1370\n",
      " 17650  4330 45740  3410  8670 13130 19780  2390 32240 26490 25430  9820\n",
      "  2630 20640 16990   630  5390 15490  3210  1530  9770 17280  5090  7180\n",
      "  9560 48330  1760 24770  3870 18620 12770  9640  2590 24530 16210 17570\n",
      "  7980  3290  6320  5070  3470  2720 14600  6890 27650  8860  5000  1120\n",
      "   940 14040  4770  3440  3020  6270 21770   740 21370  1020  9680 21810\n",
      " 10620  3860 29190  4570  7550 12430 19700  4450 18670 19370 18540  3920\n",
      "  3170  7290  1980 12480  3100  7240 18710  2620  6420   470  5150 15700\n",
      "  5460 22350  2810  2820  6860 18020  1670  2220  1430   870  6300 19830\n",
      "  9430 23620  9630  4180  3890  4420 21930  2480  3460  6560  5840  2230\n",
      " 19640  6480  4610  6330  1520  3740  1990 36410  7680 13750 27150 17290\n",
      " 26990 29070  3750 13170  5080 13190  5350  3230  3380  3430  8110  6250\n",
      " 12020  5010 18050  5380 16680 11540  2210  4300  5220  9990 10450   690\n",
      "  1830  5330  1400  3490  1900  1880 21790]\n",
      "Unique values in CompetitionOpenSinceMonth: [ 9 11 12  4 10  8  3  6  5  1  2  7]\n",
      "Unique values in CompetitionOpenSinceYear: [2008 2007 2006 2009 2015 2013 2014 2000 2011 2010 2005 1999 2003 2012\n",
      " 2004 2002 1961 1995 2001 1990 1994 1900 1998]\n",
      "Unique values in Sales: [ 5263  6064  8314 ...   660 17815 23303]\n"
     ]
    }
   ],
   "source": [
    "def print_unique_values(dataframe):\n",
    "    for column in dataframe.columns:\n",
    "        unique_values = dataframe[column].unique()\n",
    "        print(f\"Unique values in {column}: {unique_values}\")\n",
    "\n",
    "# Example usage:\n",
    "print_unique_values(df)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Save The Model "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['model2.pkl']"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import joblib\n",
    "\n",
    "# joblib.dump(pipe, 'model2.pkl')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "model1 = joblib.load(\"../models/model2.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([6357.158], dtype=float32)"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model1.predict(temp_df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# ..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<hr>\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}