predictive_analytics.ipynb 6.08 MB
Newer Older
OndrejKopicka's avatar
OndrejKopicka committed
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.6.8 (default, May  7 2019, 14:58:50) \n",
      "[GCC 5.4.0 20160609]\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "print(sys.version)\n",
    "# should be 3.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "start_time: 2019-12-12 18:25:20.151746\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "start_time = datetime.now()\n",
    "print('start_time:', start_time)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# pbi.ai templates\n",
    "## Predictive Analytics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Welcome!\n",
    "\n",
OndrejKopicka's avatar
wording    
OndrejKopicka committed
56
    "We created this notebook to provide a practical example of how AI and Data Science can be used when dealing with predictive analytics. It's also a follow up on our article Predictive Analytics which can be found at http://bit.ly/2P2If2s\n",
OndrejKopicka's avatar
OndrejKopicka committed
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
    "\n",
    "**Our vision is that Artificial Intelligence isn't just about the code. Also, it's not just about fancy \"business talk\".**\n",
    "That's why we combine theory with practical examples wherever it's possible. Our aim is to share knowledge with fellow AI experts, data scientists, machine learning engineers, marketing professionals and business analysts. In other words, all the people who are dealing with the data every day. Don't reinvent the wheel!\n",
    "\n",
    "Have you been wondering how AI can help improve business? Our articles and tips could help you on your journey :) Visit our blog:\n",
    "- http://bit.ly/pbiai-blog\n",
    "\n",
    "Do you have an idea for a new AI product? Have you been thinking about using AI in your company? We can help you with that. You can reach us via our website\n",
    "- https://www.pbi.ai/\n",
    "\n",
    "or via social media\n",
    "\n",
    "- facebook ( https://www.facebook.com/pbiai/ )\n",
    "- LinkedIn ( https://www.linkedin.com/company/18178189/\n",
    "- Twitter ( https://twitter.com/pbi_ai ).\n",
    "\n",
    "Are you from the Czech Republic? Šablona je dostupná také v českém jazyce na http://bit.ly/AI_template_predictions_CZ\n",
    "\n",
    "Enjoy!\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Template Content\n",
    "### 1 Data\n",
    "#### 1.1 Knowledge Representation: Segmentation and Discretization\n",
    "#### 1.2 Knowledge Representation: Time Series Analysis\n",
    "#### 1.3 Knowledge Representation: Polynomial Features\n",
    "### 2 Experiments and AI prototyping\n",
    "#### 2.1 Future Purchase Prediction (Random Forest)\n",
    "##### 2.1.1 Preparation of model input\n",
    "##### 2.1.2 Model training\n",
    "##### 2.1.3 Model evaluation (testing dataset)\n",
    "##### 2.1.4 Model evaluation (validation dataset)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1 Data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Previously, in our \"Return of Experience\" template ( http://bit.ly/AI_template_personalization ), we used dummy data similar to real e-commerce data. It was for the transaction history of a fictive e-commerce store. We performed a brief exploratory analysis focused on the relationship between time, transactions, customer features and product features. We will use the same dataset in this template. We will skip the initial analysis to follow the DRY rule (Don't Repeat Yourself) even it's as important as in the last case. Instead, we will focus on **knowledge representation** and **feature engineering**."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Up to 80 % of a Data Science professional's time is spent preparing the data. In particular, **feature engineering** is an activity which basically defines the Data Scientist’s role. The main purpose of feature engineering is to prepare the input for machine learning models. To do it right, one must combine business expertise, tech knowledge and proficiency in applied mathematics/statistics.\n",
    "\n",
    "There are many ways how to approach feature engineering. We recommend starting with business analysis to reveal the core issues of the problem. At the end of the day we should have a clear idea of what data we need, what data sources should be used, and which variables are worth using for mathematical modeling. We will focus on the **future purchase prediction**. That's why we will do a little magic with the transaction history:\n",
    "- segmentation and discretization\n",
    "- time series analysis\n",
    "- polynomial features"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd # basic library for data manipulation\n",
    "\n",
    "# load purchases\n",
    "purchases = pd.read_csv(\"dummy_data_purchases.csv\", sep=',')\n",
    "\n",
    "# parse the timestamp into the datetime object\n",
    "purchases['timestamp'] = purchases['timestamp'].apply(\n",
    "    lambda timestamp_string: datetime.strptime(timestamp_string, '%Y-%m-%d %H:%M:%S.%f')\n",
    ")"
   ]
  },
  {
   "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>customerid</th>\n",
       "      <th>itemid</th>\n",
       "      <th>timestamp</th>\n",
       "      <th>price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>11779</td>\n",
       "      <td>45481</td>\n",
       "      <td>2018-02-17 11:09:09.629588</td>\n",
       "      <td>12783.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>15492</td>\n",
       "      <td>45481</td>\n",
       "      <td>2019-02-20 02:01:51.322820</td>\n",
       "      <td>12648.64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>11480</td>\n",
       "      <td>45481</td>\n",
       "      <td>2018-04-12 07:01:25.615314</td>\n",
       "      <td>13456.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10002</td>\n",
       "      <td>45481</td>\n",
       "      <td>2018-05-09 10:01:18.987823</td>\n",
       "      <td>12244.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>16456</td>\n",
       "      <td>45481</td>\n",
       "      <td>2019-02-07 19:01:58.634323</td>\n",
       "      <td>13186.88</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customerid  itemid                  timestamp     price\n",
       "0       11779   45481 2018-02-17 11:09:09.629588  12783.20\n",
       "1       15492   45481 2019-02-20 02:01:51.322820  12648.64\n",
       "2       11480   45481 2018-04-12 07:01:25.615314  13456.00\n",
       "3       10002   45481 2018-05-09 10:01:18.987823  12244.96\n",
       "4       16456   45481 2019-02-07 19:01:58.634323  13186.88"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "purchases[:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np # library for the basic mathematical functions\n",
    "import matplotlib # library for plotting\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns # library for plotting\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA8EAAADhCAYAAADoDLerAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xd8jff7x/HXGdlTlpFlltqKGiVqJyrVqlVV3apG0QptrJpBU5uqtpSWEkq1fr52bVWjRhBbZJAtcTLP+v2hzbe+aIwkd3JyPR+PPOTc5z73/b7PJeE69+f+3Cqz2WxGCCGEEEIIIYQoA9RKBxBCCCGEEEIIIYqLNMFCCCGEEEIIIcoMaYKFEEIIIYQQ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YXljb1pIiIiIiLyKxqCRVzkxklP1/6/jvyKiIiIiBiTb2NvgIiIiIiIiEhD0RAsIiIiIiIiXkNDsIiIiIiIiHgNDcEiIiIiIiLiNUx/9R5fX5/G3oSL5knbKr9NPc1FPc1JXc1HTc1FPT2b+pmLEXvWd5tM/znBIiIiIiIiImfpdGgRERERERHxGhqCRURERERExGtoCBYRERERERGvoSFYREREREREvIaGYBEREREREfEaGoJFRERERETEa2gIFhEREREREa+hIVhERERERES8hoZgERERERER8Roagi/DvHnzGDZsGMOGDeONN94A4LvvvmPEiBEMGjSIN99885zfmTZtGp999lnt1+np6UyYMIFRo0Zx9913k5GRcd51nTx5kgkTJjB48GAefvhhSktLATh8+DDjx49n5MiRF/x9+W1G6Llt2zb69OnDqFGjGDVqFM8995wb9tQ7GKHn2LFja1veeuutdO3alby8PDfsrfcwQtfjx48zceJERowYwd13382xY8fcsKfeoyGbnvXWW2/x9ttvn3P7smXLSEpKusw98m6u6Pnjjz8ybtw4RowYweTJk8nNzT3vuuq6j56lnpfOCP303Na1jNDUkM9vnVIvmzZtcv7+9793VlZWOquqqpyTJk1yrlixwpmYmOhMTU11VldXO++77z7n+vXrnU6n05mVleWcPHmys0ePHs5PP/20djnPPPOM8/3333c6nU7nkiVLnE8//fR51/fQQw85V65c6XQ6nc558+Y533jjDafT6XROnDjRuWHDBqfT6XR+8MEHzqeeespt+2xmRum5aNEi51//+ld37qpXMErPfzV16lTnggULXL2rXsUoXcePH1+7vJ07dzpHjhzptn02u4ZuWlxc7HzuueecPXr0cM6dO7f29oqKCuef//xnZ3x8vHPatGlu3GNzc0VPh8PhTExMdG7evNnpdDqdq1atck6ePPm866vrPqqe9WOUfnpu6zpGaWrE57c6ElxPkZGRJCUl4e/vj5+fH1dccQXHjx8nLi6O1q1bY7VaGTFiBKtXrwZgxYoV3HzzzQwZMuQXy3E4HJSUlABQXl5OYGDgOeuqrq5m27Zt3HrrrcCZo0tnl/vuu++SkJCAw+Hg5MmTNG3a1J27bVpG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OQP/+/fH398fPz49OnTpx6tSp865j4MCBBAUFYbFY6NixY73faywiIuJJdDq0iIiIQY0cOZLly5djs9kYNWpU7e2+vue+hu10Omvf7xsYGFh7u4+PT+0R4l+zWq0X9XMiIiJmoiPBIiIiBjVq1ChWr15NSkoKw4cPr729X79+pKSk1B65/fTTTwkLCyMuLu6Cy7NYLLowloiIeD0dCRYRETGo6OhorrjiCkJDQwkLC6u9vU+fPtxzzz384Q9/wOFwYLPZWLhw4XmPEP+rAQMG8Prrr1NdXe3uTRcRETEsH6fOfRIREREREREvodOhRURERERExGtoCBYRERERERGvoSFYREREREREvIaGYBEREREREfEaGoJFRERERETEa2gIFhEREREREa+hIVhERERERES8hoZgERERERER8Rr/H+fey5byUsNrAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1152x216 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "pd.plotting.register_matplotlib_converters() # timeseries converter\n",
    "\n",
    "# create a new column for the hour of day of the transaction\n",
    "# - it will be useful in the future computations\n",
    "purchases['timestamp_hour_of_day'] = purchases['timestamp'].apply(\n",
    "    lambda timestamp: timestamp.hour\n",
    ")\n",
    "\n",
    "sns.set(rc={'figure.figsize':(16, 3)})\n",
    "plt.figure()\n",
    "plt.title('Historical shopping activity:')\n",
    "plt.plot(purchases.set_index('timestamp').resample('M').count())\n",
    "plt.xlabel('Month')\n",
    "plt.ylabel('# purchases')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In a real case we would think about **the right period for modeling**. Web and mobile apps are usually being improved continuously. This affects the user experience and possibilities to interact with the customer. During the mathematical modeling, we strive to create simulations that are as real as possible. If the web app has recently undergone big changes, it may be worth excluding older data.\n",
    "\n",
    "Also, we need to think about the seasonality, weekends vs. workdays and anomalies caused by ad-hoc marketing campaigns. Before modeling, we should consider the whole external context which could significantly affect customer preferences. In this template we use dummy data - that's why we will skip this part. We will do just one thing - we will filter out a period between March and August 2018 due to the low number of transactions.\n",
    "\n",
    "When predicting the future, we usually analyze particular history to forecast events during a near period in the future. The ideal length of these periods should be determined by the initial business analysis. We should choose a length of time that contains a sufficient amount of data but is relevant to the period we are trying to predict. This could be different for each industry or customer segment. In this template, we will use three months of history to predict purchase in the next month. Let's create these subsets of our data:\n",
    "- period 1: September-November 2018 (history), December 2018 (future)\n",
    "- period 2: January-March 2019 (history), April 2019 (future)\n",
    "\n",
    "Period 1 will be used for model training and testing. We will use the second period for experimenting how the model trained on the autumn data would work during the spring."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of historical transactions:\n",
      "Period 1 (history): 16550\n",
      "Period 2 (history): 14764\n"
     ]
    }
   ],
   "source": [
    "from calendar import monthrange\n",
    "\n",
    "purchases_period1_history = purchases[\n",
    "    (purchases['timestamp'] >= datetime(2018, 9, 1))\n",
    "    & (purchases['timestamp'] <= datetime(2018, 11, monthrange(2018, 11)[1]))\n",
    "]\n",
    "purchases_period1_future = purchases[\n",
    "    (purchases['timestamp'] >= datetime(2018, 12, 1))\n",
    "    & (purchases['timestamp'] <= datetime(2018, 12, monthrange(2018, 12)[1]))\n",
    "]\n",
    "\n",
    "purchases_period2_history = purchases[\n",
    "    (purchases['timestamp'] >= datetime(2019, 1, 1))\n",
    "    & (purchases['timestamp'] <= datetime(2019, 3, monthrange(2019, 3)[1]))\n",
    "]\n",
    "purchases_period2_future = purchases[\n",
    "    (purchases['timestamp'] >= datetime(2019, 4, 1))\n",
    "    & (purchases['timestamp'] <= datetime(2019, 4, monthrange(2019, 4)[1]))\n",
    "]\n",
    "\n",
    "print('Number of historical transactions:')\n",
    "print('Period 1 (history):', purchases_period1_history.shape[0])\n",
    "print('Period 2 (history):', purchases_period2_history.shape[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's \"pull out\" the data about customerids for each period:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of unique customerids:\n",
      "Period 1 (history): 8098\n",
      "Period 2 (history): 7698\n"
     ]
    }
   ],
   "source": [
    "customerids_period1_history = set(purchases_period1_history['customerid'])\n",
    "customerids_period2_history = set(purchases_period2_history['customerid'])\n",
    "\n",
    "# DataFrame for storing customer features\n",
    "customers_period1_history = pd.DataFrame({'customerid': list(customerids_period1_history)})\n",
    "customers_period2_history = pd.DataFrame({'customerid': list(customerids_period2_history)})\n",
    "\n",
    "print('Number of unique customerids:')\n",
    "print('Period 1 (history):', len(customerids_period1_history))\n",
    "print('Period 2 (history):', len(customerids_period2_history))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.1 Knowledge Representation: Segmentation and Discretization"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In general, there are two ways how to approach predictive analysis:\n",
    "- **classification** – segmenting customers into groups based on future behavior\n",
    "- **regression** – forecasting the value of particular variables\n",
    "\n",
    "Sometimes one approach could be converted to the other, for example prediction customer churn:\n",
    "- Customer features are used to assign a label to each customer based on whether or not he may churn (classification). In other words, we are saying that particular set-up of customer features is correlated with a particular variable (regression). If the value of this variable exceeds some threshold, the customer will churn. The variable could be customer activity or satisfaction, for instance.\n",
    "\n",
    "This kind of problem conversion is nothing but common sense. Nevertheless, the chosen approach is very important\n",
    "when it comes to mathematical modeling because it determines how we will work with the **search space**:\n",
    "- classification – **discrete search space**\n",
    "- regression – **continuous search space**\n",
    "We can also combine both approaches into a hybrid model using fuzzy modeling. For instance, we can assign each customer a membership into particular segments. Membership function is usually continuous, segments are discrete."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Customer segmentation based on the amount of purchases"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can use similar principles during feature engineering. Each continuous variable can be converted into a categorical variable. We can also combine multiple features to create completely new segments. We can use this technique when working with time or price. We have a price in our dummy data as well. Let's use it to create new customer segments based on the amount of purchases."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For each customer, we can compute new characteristics:\n",
    "- number of purchases during the particular period\n",
    "- median of purchases\n",
    "- standard deviation of the purchase amounts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "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>customerid</th>\n",
       "      <th>purchases_price_list</th>\n",
       "      <th>purchases_count</th>\n",
       "      <th>purchases_median</th>\n",
       "      <th>purchases_std</th>\n",
       "      <th>purchases_std_percentage</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10000</td>\n",
       "      <td>[5394.0]</td>\n",
       "      <td>1</td>\n",
       "      <td>5394.00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10002</td>\n",
       "      <td>[519.75, 17474.940000000002, 10755.84, 18078.65]</td>\n",
       "      <td>4</td>\n",
       "      <td>14115.39</td>\n",
       "      <td>7069.765256</td>\n",
       "      <td>50.085511</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10003</td>\n",
       "      <td>[5321.0, 2864.0, 23933.0, 18344.0]</td>\n",
       "      <td>4</td>\n",
       "      <td>11832.50</td>\n",
       "      <td>8792.084522</td>\n",
       "      <td>74.304539</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10004</td>\n",
       "      <td>[18691.25, 16645.5, 6510.0]</td>\n",
       "      <td>3</td>\n",
       "      <td>16645.50</td>\n",
       "      <td>5325.998132</td>\n",
       "      <td>31.996625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10005</td>\n",
       "      <td>[3575.0, 2922.0, 6907.8, 79.0]</td>\n",
       "      <td>4</td>\n",
       "      <td>3248.50</td>\n",
       "      <td>2428.447819</td>\n",
       "      <td>74.755974</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customerid                              purchases_price_list  \\\n",
       "0       10000                                          [5394.0]   \n",
       "1       10002  [519.75, 17474.940000000002, 10755.84, 18078.65]   \n",
       "2       10003                [5321.0, 2864.0, 23933.0, 18344.0]   \n",
       "3       10004                       [18691.25, 16645.5, 6510.0]   \n",
       "4       10005                    [3575.0, 2922.0, 6907.8, 79.0]   \n",
       "\n",
       "   purchases_count  purchases_median  purchases_std  purchases_std_percentage  \n",
       "0                1           5394.00       0.000000                  0.000000  \n",
       "1                4          14115.39    7069.765256                 50.085511  \n",
       "2                4          11832.50    8792.084522                 74.304539  \n",
       "3                3          16645.50    5325.998132                 31.996625  \n",
       "4                4           3248.50    2428.447819                 74.755974  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# aggregate historical data and put the purchase amounts into a new column\n",
    "customers_period1_history = purchases_period1_history \\\n",
    "    .groupby('customerid')['price'] \\\n",
    "    .apply(list) \\\n",
    "    .reset_index(name='purchases_price_list')\n",
    "\n",
    "customers_period2_history = purchases_period2_history \\\n",
    "    .groupby('customerid')['price'] \\\n",
    "    .apply(list) \\\n",
    "    .reset_index(name='purchases_price_list')\n",
    "\n",
    "# create a new column based on number of purchases\n",
    "customers_period1_history['purchases_count'] = customers_period1_history['purchases_price_list'].apply(len)\n",
    "customers_period2_history['purchases_count'] = customers_period2_history['purchases_price_list'].apply(len)\n",
    "\n",
    "# create a new column for the median of purchases amount\n",
    "customers_period1_history['purchases_median'] = customers_period1_history['purchases_price_list'].apply(np.median)\n",
    "customers_period2_history['purchases_median'] = customers_period2_history['purchases_price_list'].apply(np.median)\n",
    "\n",
    "# create a new column for the standard deviation of purchases amount\n",
    "customers_period1_history['purchases_std'] = customers_period1_history['purchases_price_list'].apply(np.std)\n",
    "customers_period2_history['purchases_std'] = customers_period2_history['purchases_price_list'].apply(np.std)\n",
    "\n",
    "# create a new column for the standard deviation of purchases amount in percentage form\n",
    "# based on the median of purchases amount\n",
    "customers_period1_history['purchases_std_percentage'] = customers_period1_history.apply(\n",
    "    lambda customer_history:\n",
    "        (customer_history['purchases_std']/customer_history['purchases_median'])*100,\n",
    "    axis=1\n",
    ")\n",
    "\n",
    "customers_period2_history['purchases_std_percentage'] = customers_period2_history.apply(\n",
    "    lambda customer_history:\n",
    "        (customer_history['purchases_std']/customer_history['purchases_median'])*100,\n",
    "    axis=1\n",
    ")\n",
    "\n",
    "customers_period1_history[:5]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "After the procedure, we have a few new variables: `purchase_count`, `purchase_median`, `purchase_std` and `purchase_std_percentage`. All these variables are continuous and can be used for machine learning. Their range of values is wide, though, and it can be difficult to interpret their relationships. We can make this easier using **discretization**. Let's divide customers into new segments based on the values of these continuous variables. We can start with the `purchase count`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA8EAAADhCAYAAADoDLerAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGx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Pl64oknCrw3efJkNWvWTAMHDrzqsgDgZgDACyQmJpr+/ftfc57x48ebN99884pph8NhmjZtalJTU40xxqxevdosXbr0imXmzZtnnn76aZOXl2ecTqeZMGGCiY2NNcYY06FDBzNz5kxjjDGffPKJCQkJMQcPHjTGGPOXv/zFLFq0yBhjzJAhQ8zGjRuNMcbk5OSYIUOGmE8++cScOHHCNG7c2OzcufOqsXfq1Ml8++23xhhjvv76a/Pqq68aY4yZMGGC+ec//2mMMcbhcJjnn3/evPHGG+ann34ybdq0ccewatUq07hxY3PixAmzcuVKc88995hTp04Zp9NpevbsaUaNGmWcTqc5ePCgad68uXE6neabb74xgwYNMtnZ2e719ujRw71fHnnkEZObm2vy8vJM3759zYoVK4wxxvzpT38yn376qTHGmOjoaLNu3TpjjDEHDx4006ZNu2Lbtm/fbkJCQszu3buNMcYsXbrUREZGGmOMiY+PN2vWrDHGGJOXl2d69+5tEhMTzalTp8zdd99tcnNzjTHGvPXWW2bDhg0mPz/f9OzZ0+zfv98YY8z58+dNjx49zLfffms2bNhgevbsaTIzM01+fr558sknzZ/+9Kcr4klKSjKdO3c2GRkZxhhjVq5caXr06GFcLtc1t/tyK1euNE8++aR7++68807z3XffGWOMeeedd0x0dLQxxphXX33VxMfHG5fLZYwx5m9/+5uZOnXqFf3Nnz/fdOrUyWRmZhpjjBk+fLiZN2+eMeaXY2/v3r3ueS9NXzqmvvjiC2OMMVOmTDEdOnQwmZmZJicnx7Rr187s3r3bPd8nn3xijDHmq6++MuHh4SY3N9esXr3ajB492uTn57tz8/jjj7vzPHHixCtiNcaYFStWmEceecRcuHDBHf+jjz7qfj19+vSrLnf5sTN+/HgzdOhQ93uFHQvGGNO4cWOzZMkSY4wx+/btM82aNTM5OTlmwYIF7s/ohQsXzOjRo8358+fNp59+al544QV337GxsSYuLs4YY8zIkSPNrFmzjDG/HD+9evUyycnJBeK+PL+DBw82b7/9tnv+iIgIs27dOvd+3bRpkzHml++oBx980BhjzMSJE83rr79ujDEmLS3Nj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umFF17Q+fPnr/pj+/Dhwzp48KCkX67Hveeee1S1alVt2bJFI0eOVM+ePWWxWLRnzx45nU4dOnRIvXv3VsOGDTV8+HANGzZMhw8fVv369eXv7+8ugk+fPq3evXtr//79euCBB5SYmKjz58/L5XIVKJQv1759e61fv14//fSTJGnlypVFXkN8rX1wLe3bt9d7772nvLw8uVwuxcbGuq/TvV41atRwH9ffffed0tPTi7W8JP3888/617/+JUnatGmT/P39Va9ePbVv314rVqxwf6bmzZuncePGFdlf+/bttWrVKveZ2iVLlujee++94p8vv3at/VbYsXAtCQkJWrhwoTp37qzJkyfrjjvuUHJysrZs2aKHHnpIAwYMUP369bVp0yZ3X6Ghoe4z9ZmZmRo6dKiSk5OvGltgYKBatmzpvoN8Zmam1qxZo7Zt214zrueee07r169Xr169NHXqVAUGBur06dPXXOZ6WK3WAv+YK0xx8rp9+3b3Td6WLl2qDh06uPu42ndPUeu92nFx2223qWnTplq+fLkk6cCBA/r++++vb6MBoAT4NxsArzF16lQtXLhQUVFRslqtysvLU+fOnd2PDBkyZIief/55devWTXXq1FGbNm0k/VJEjBgxQsOGDVOVKlVktVrdQ4fDwsL0wgsvSJJGjBihWbNmqW/fvnI4HGrRooViY2OLFWNCQoJeeOEFRUREKC8vT71799Yf//jHKx4VczmbzaZJkybp+eefd5+lmjlzpvz8/DR58mTNmDFDERERys/PV9u2bfX444/L19dXr7zyisaPHy8fHx81a9ZMNpvNfQb6ejzwwAN64okn9Oijj8pisSgwMFALFiwospDu0KGDZs2apfz8fD3//POaOXOm5s6dKx8fHz399NNX3BFYkho0aKAFCxboxIkTqlmzpuLj4yX9cgZ85MiRuvnmm1W1alXde++9+vHHHzVgwAD16NFD/fv3V0BAgKpUqaKYmBj5+flp4cKFmjFjht588005HA799a9/dQ+rPXz4sPr376/q1asrJCTEfcOky7Vr107Dhg3T0KFD5XK5VKNGDb3++utFDle93F133aW5c+dq5MiRio6OLnS+v/zlL5o1a5YeeughOZ1O3XnnnZowYcJ1r0eSnn/+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J06c0O9+9ztPh4Ey0L59e/3nP/9Rv3795Ovrq+bNm+vJJ5/0dFhlwmKMMZ4OAgAAAACAG4Hh0AAAAACASoMiGAAAAABQaVAEAwAAAAAqDYpgAAAAAEClQREMAAAAAKg0KIIBACiFxx57TEeOHFFeXp66det21XkeffRR/fTTTzc4suuzYMECffHFF5KkefPmac2aNR6OCACA8sVzggEAKCGHw6ETJ06oYcOG2rFjh5o3b37V+bZu3XqDI7t+33zzje644w5J0l//+lcPRwMAQPmjCAYAoASeeOIJHT16VFlZWerTp49SU1N100036b333tPgwYPd802cOFGSNHToUL3xxhsaPHiwWrRoocOHD+vZZ5+VzWbT66+/rry8PP3000/q27evRo8erW+++UZz5sxR3bp19cMPPygvL09TpkzR/fffr127dik+Pl4ul0uSNHz4cHXr1k3Hjh1TXFycsrOzlZaWppCQEM2dO1f+/v7as2ePXnzxRV28eFG+vr4aN26cjh49qv3792v27NmyWq3auHGjGjVqpMcee0y7du3S7Nmz3fOPHj1aYWFhWrVqlTZs2CAfHx8dP35cvr6+mjVrlho3bqzPP/9cixYtksVikdVq1bhx43Tvvfd6JD8AABTKAACAEnnvvffM4sWLjTHGjBw50hw4cOCq8zVu3NhkZGQYY4zp0KGDWbBggTHGGJfLZf70pz+ZY8eOGWOM+d///mfuvPNOk5GRYbZv327uvPNO85///McYY8xbb71lBg8ebIwxJjo62qxbt84YY8zBgwfNtGnTjDHGxMfHmzVr1hhjjMnLyzO9e/c2iYmJJi8vz7Rr187861//MsYYs2/fPtO7d2/jdDrNn/70J/Ppp58aY4wZP368efPNN81PP/1kQkNDzXfffWeMMeb77783bdq0MT/++KNZuXKlueeee8zp06eNMcbExcWZcePGGWOM6dSpk/n222+NMcZ8/fXX5tVXXy3tLgYAoMxxJhgAgBI6dOiQOnfuLEn64Ycf3MOKi9K6dWtJksVi0eLFi/Xll19q3bp1OnLkiIwxunjxoiTp//2//6c777xTktSkSROtXr1aktSjRw/FxcVp06ZNatu2rZ599llJ0tixY7V161b9/e9/V3JystLS0pSdna3vv/9ePj4+evDBByVJzZo108cff1xofHv37tXtt9+uli1bSpIaNWqku+++Wzt27JDFYlHTpk31u9/9zh3Xhg0bJEm9evXS008/rfDwcLVr105PPPHEde9LAABuFG6MBQBACTzxxBNau3atZs+erd69eys1NVUDBgzQe++9V+SyAQEBkqTs7Gw99NBDOnDggJo0aaJx48bJZrPJGCNJqlKlinsZi8Xibo+KitJHH32kdu3aacuWLfrjH/+ozMxMPfvss1q2bJlq166tYcOGqWnTpjLGyGq1ymKxFIjh+++/l8PhuGp8l4ZZX84Y456/sLjGjBmjDz74QM2aNdOqVav0yCOPXLUvAAA8iSIYAIASmDt3rmrXrq1169Zp9OjRioyM1Nq1awtcD3yJ1Wq9asF5/PhxZWVlafTo0erYsaN27NihvLy8IgvHqKgoHTx4UP369dMLL7yg8+fP69y5c9qyZYtGjhypnj17ymKxaM+ePXI6nWrQoIEsFov7Bl0HDhzQ0KFD5XK5rhpby5YtdezYMe3du1fSL2e5d+7cqTZt2hQak8PhUMeOHZWdna2BAwdq6tSpOnLkSKGFNgAAnsJwaAAASuC7777T3XffLUnatWvXNW8A1aVLFw0aNEgLFy4s0P6HP/xBDz74oHr06KHq1avr9ttv1x133KHjx4/Lz8+v0P6ef/55zZw5U3PnzpWPj4+efvpp1alTR2PGjNHIkSN18803q2rVqrr33nv1448/ys/PT6+++qpmzpyp2bNny9fXV6+++qr8/PzUoUMHzZo1S/n5+e7+a9SooXnz5umFF15QTk6OLBaLXnrpJdWvX1/ffvvtVWOy2WyaNGmSnn/+edlsNlksFs2cOfOa2wEAgCdYzKUxTAAAAAAAeDmGQwMAAAAAKg2KYAAAAABApUERDAAAAACoNCiCAQAAAACVBkUwAAAAAKDSoAgGAAAAAFQaFMEAAAAAgEqDIhgAAAAAUGn8f/7/tqV0AsVxAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1152x216 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure()\n",
    "plt.title('Customer segments based on the number of transactions in the period 1:')\n",
    "plt.hist(\n",
    "    x=customers_period1_history['purchases_count'],\n",
    "    bins='auto',\n",
    "    color='#0504aa',\n",
    "    alpha=0.7,\n",
    "    rwidth=0.85)\n",
    "plt.xlabel('# transactions')\n",
    "plt.ylabel('# customers')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can use insights about distribution of `purchase_count` values to create a new feature `purchase_count_segment`. For instance, we can split customers into these segments:\n",
    "- segment 1:  `purchase_count` 1 (new customers)\n",
    "- segment 2: `purchase_count` 2-5 (occasional customers)\n",
    "- segment 3: `purchase_count` 6+ (active customers)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA8EAAADhCAYAAADoDLerAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XlcVXX+x/H35V7ABc1UcMxtHNPMzCgdExdIMxGR1LLJ5edSVlqmZaWiouRWaoxbpq1TjWWmmY6pUVijTYJmNqmZS1OigAiIK6gs935/f/jgPkA2Fza5r+fj4ePB/XLOuZ+z3O/xfc/3HCzGGCMAAAAAAFyAW3kXAAAAAABAWSEEAwAAAABcBiEYAAAAAOAyCMEAAAAAAJdBCAYAAAAAuAxCMAAAAADAZRCCgTIWHx+v2267TatXr87T/t577yk0NLTE3qdbt27au3dviS2vKGlpaRowYICCg4P11Vdfldr7LFmyRJs3by615V+vJ598Uv/73/+uap7HH39cJ0+elFS2++xqxMfH6+677y7vMpy2bNmiRYsWXfV8I0eO1Oeff14KFZWd1atX6+OPP77i6ctr3+3du1fdunUrlWXHxcVpzJgxkiresVmQ2267zfkZL22Ji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bwcHBeX6XM/rmueeeK3Be4IZjAJSpuLg44+vra+x2uxk0aJCZM2eOMcaYd99910ycONEYY8zEiRPNu+++65wn9+uuXbuaV155xRhjzMaNG03Lli3N/v37jTHGPPPMM2bZsmXO6cLDw40xxhw/ftx06NDBHDp0yBw+fNj07t3bnDx50hhjzKFDh0ynTp1Menq6Wbx4sQkMDDRZWVn56v7f//5nOnbsaI4ePWqMMSY6Otp06tTJnDt3zmzfvt0EBwcXuL6jR482c+fONcYYc/bsWRMcHGxiY2PN//3f/5kvv/zSOV3O62PHjpl77rnHZGRkGGOMee+990xUVFSeaYwxZsKECWbmzJnG4XCYjIwM8/jjj5u33nrLGGNMixYtzIcffmiMMeatt94yd999tzl+/Lix2+2mX79+Zv369SYrK8v06tXL/PLLL87agoKCzH//+1+zfft207JlSxMfH2+MMWbt2rXm8ccfN8YYk52dbaZMmWJiY2PzrWvXrl3Nnj17zPbt283tt99ufv31V+c6DB48uMDt06JFC5Oamuqcf8aMGcYYY5KTk03r1q3NsWPHitxnucXFxZkWLVqYb7/91hhjTGRkpLnvvvuc6/D888879+3KlSvNE088YS5cuGDuuecec+bMGRMXF2c6depkHn30UWOMMR999JEJDw93HrPGGPP++++bsWPHGmOMOXfunOnQoYM5c+ZMnjpSUlJM27Ztnev/1VdfmREjRjjr27lzpzHGmNOnT5sePXqYuLg4Y8yl49Tf398kJCSYL7/80sycOdO5zKlTpzq3zeLFi8306dONMcbs2LHDDBo0yJw/f94YY8x//vMfExQUZIy59HlYsGCBMcaY2NhY4+vra9asWZNvHwwdOtRs2LDBGGPM/v37zcsvv2yMMeb11183c+bMMQ6HwxhjzN///ncTHh5usrKyjL+/v9myZYsxxpiYmBhz2223me3btzv3/b59+4wxxowYMcI8+uijJiMjw6Smppo77rjDHD9+vNjP4f3332/OnTtnjDFm5MiRZtGiRcaYvH3BpEmTnMd8cnKyef75543dbi/wmNi4caMxxpjvvvvOBAQEmIyMDPPBBx8453c4HOaJJ54w7733nsnOzjZ33HGHSUp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GIRgAAAAA4DIIwQAAAAAAl0EIBgAAAAC4DEIwAAAoUFxcnMaMGVPeZQAAUKIIwQAAoEDHjh3T4cOHy7sMAABKFH8nGACAMpaenq5JkybpyJEjcnNz0x133KEZM2Zoy5YtWrZsmbKyslSlShVNnDhRd999ty5cuKDw8HDt3r1bNWrU0K233ipJmjNnjrp166bevXtry5YtOn36tMaMGaOffvpJ+/btk81m07Jly1SvXj0lJSVpxowZSkxMVFZWloKDgzVq1CjFx8dr+PDhCggI0O7du3XmzBmNGzdOgYGB6tmzp5KSkvTXv/5V7733XjlvNQAASgZXggEAKGNRUVFKT0/Xv/71L3322WeSpKNHj2rBggV6++23tW7dOs2cOVNjxozR+fPntXTpUtntdn355Zf64IMP9Ouvv+ZZXkZGhtavX6/Q0FBNmzZNw4YN0/r161W/fn2tXbtWkjR+/Hg9/PDD+vzzz/XZZ58pOjpamzZtknRp2HPnzp312Wef6aWXXtJrr70mq9WqWbNmqXHjxgRgAEClYivvAgAAcDVt27bVggULNGTIEHXs2FHDhg3Ttm3blJycrOHDhzuns1gsOnr0qLZu3apJkybJzc1NXl5e6tevnw4ePOicrkePHpKkRo0aqW7dumrZsqUkqXHjxjpz5ozOnz+vnTt36syZM1q0aJEk6fz58zpw4IDatGkjd3d3BQQESJJatWql06dPl9GWAACg7BGCAQAoY40aNVJUVJR27Nih7du367HHHtPAgQPl5+enhQsXOqdLTEyUj4+PbDabct+95OaWdyCXh4eH82d3d/d87+dwOGSM0cqVK1W1alVJ0smTJ+Xp6alTp07J3d3duUyLxVKi6woAQEXDcGgAAMrYihUrNGnSJHXu3Fnjx49X586ddfDgQW3btk2///67JGnr1q168MEHlZGRoYCAAK1Zs0YOh0MXLlzQhg0briqsenl5ydfXV++//74k6ezZsxo4cKC++eabIuezWq3Kysq69hUFAKAC4kowAABlrG/fvvrhhx/Uq1cvVa1aVbfccotmz56t6OhovfDCCzLGOB9qVa1aNY0cOVIzZsxQSEiIatSooTp16qhKlSpX9Z4RERGaOXOmQkJClJmZqd69e+vBBx9UfHx8ofM0b95cVqtV/fv31+rVq7lKDACoFHg6NAAAFdzGjRvl5eWlgIAAORwOjRkzRp06ddKgQYPKuzQAAG44hGAAACq4Q4cOadq0abpw4YKysrJ07733avLkyQXe/wsAAIpGCAYAAAAAuAwejAUAAAAAcBmEYAAAAACAyyAEAwAAAABcBiEYAAAAAOAyCMEAAAAAAJdBCAYAAAAAuIz/B33F17WcVDgxAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1152x216 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def getPurchaseSegment(purchase_count):\n",
    "    \"\"\"\n",
    "    Returns the customer segment\n",
    "    based on the number of purchases.\n",
    "    \n",
    "    Parameters\n",
    "    ----------\n",
    "    purchase_count\n",
    "        number of purchases\n",
    "    \"\"\"\n",
    "    if purchase_count == 1:\n",
    "        return 1\n",
    "    if (purchase_count >= 2) and (purchase_count <= 5):\n",
    "        return 2\n",
    "    if purchase_count >= 6:\n",
    "        return 3\n",
    "    \n",
    "    # default segment for the rest of the customers\n",
    "    return 0\n",
    "    \n",
    "# create a new column for the new customer segmentation\n",
    "customers_period1_history['purchase_count_segment'] = customers_period1_history['purchases_count'] \\\n",
    "    .apply(getPurchaseSegment)\n",
    "customers_period2_history['purchase_count_segment'] = customers_period2_history['purchases_count'] \\\n",
    "    .apply(getPurchaseSegment)\n",
    "\n",
    "plt.figure()\n",
    "plt.title('Number of customers in the newly created segments based on the number of transactions in the period 1:')\n",
    "plt.hist(\n",
    "    x=customers_period1_history['purchase_count_segment'],\n",
    "    bins='auto',\n",
    "    color='#0504aa',\n",
    "    alpha=0.7,\n",
    "    rwidth=0.85)\n",
    "plt.xlabel('segment')\n",
    "plt.ylabel('# customers')\n",
    "ticks = [1, 2, 3]\n",
    "labels = [1, 2, 3]\n",
    "plt.xticks(ticks, labels)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can use a similar approach with the rest of the variables."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 1.2 Knowledge Representation: Time Series Analysis"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Another parameter we can track is **regularity of purchases** or **preference of time** during the day. If the interaction with customers happens frequently, we can compute a behavioral profile for each customer. This behavioral profile can then be used to customize an offer or marketing campaigns. Also, we can create additional customer segments, for example \"early birds\" (interactions usually occur early in the morning) or \"night owls\" (interactions usually occur during the evening)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The only type of interaction we have in our dummy data is purchase history:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "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>customerid</th>\n",
       "      <th>purchases_price_list</th>\n",
       "      <th>purchases_count</th>\n",
       "      <th>purchases_median</th>\n",
       "      <th>purchases_std</th>\n",
       "      <th>purchases_std_percentage</th>\n",
       "      <th>purchase_count_segment</th>\n",
       "      <th>purchases_timestamp_list</th>\n",
       "      <th>purchases_timestamp_hour_of_day_list</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10000</td>\n",
       "      <td>[5394.0]</td>\n",
       "      <td>1</td>\n",
       "      <td>5394.00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1</td>\n",
       "      <td>[2018-09-15 15:01:37.219186]</td>\n",
       "      <td>[15]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10002</td>\n",
       "      <td>[519.75, 17474.940000000002, 10755.84, 18078.65]</td>\n",
       "      <td>4</td>\n",
       "      <td>14115.39</td>\n",
       "      <td>7069.765256</td>\n",
       "      <td>50.085511</td>\n",
       "      <td>2</td>\n",
       "      <td>[2018-10-23 12:01:40.766790, 2018-09-15 17:01:...</td>\n",
       "      <td>[12, 17, 17, 14]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10003</td>\n",
       "      <td>[5321.0, 2864.0, 23933.0, 18344.0]</td>\n",
       "      <td>4</td>\n",
       "      <td>11832.50</td>\n",
       "      <td>8792.084522</td>\n",
       "      <td>74.304539</td>\n",
       "      <td>2</td>\n",
       "      <td>[2018-11-27 22:02:40.424597, 2018-10-01 16:01:...</td>\n",
       "      <td>[22, 16, 8, 12]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10004</td>\n",
       "      <td>[18691.25, 16645.5, 6510.0]</td>\n",
       "      <td>3</td>\n",
       "      <td>16645.50</td>\n",
       "      <td>5325.998132</td>\n",
       "      <td>31.996625</td>\n",
       "      <td>2</td>\n",
       "      <td>[2018-11-16 01:02:10.427579, 2018-09-30 00:01:...</td>\n",
       "      <td>[1, 0, 11]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10005</td>\n",
       "      <td>[3575.0, 2922.0, 6907.8, 79.0]</td>\n",
       "      <td>4</td>\n",
       "      <td>3248.50</td>\n",
       "      <td>2428.447819</td>\n",
       "      <td>74.755974</td>\n",
       "      <td>2</td>\n",
       "      <td>[2018-11-05 20:01:47.643444, 2018-09-01 03:01:...</td>\n",
       "      <td>[20, 3, 16, 22]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customerid                              purchases_price_list  \\\n",
       "0       10000                                          [5394.0]   \n",
       "1       10002  [519.75, 17474.940000000002, 10755.84, 18078.65]   \n",
       "2       10003                [5321.0, 2864.0, 23933.0, 18344.0]   \n",
       "3       10004                       [18691.25, 16645.5, 6510.0]   \n",
       "4       10005                    [3575.0, 2922.0, 6907.8, 79.0]   \n",
       "\n",
       "   purchases_count  purchases_median  purchases_std  purchases_std_percentage  \\\n",
       "0                1           5394.00       0.000000                  0.000000   \n",
       "1                4          14115.39    7069.765256                 50.085511   \n",
       "2                4          11832.50    8792.084522                 74.304539   \n",
       "3                3          16645.50    5325.998132                 31.996625   \n",
       "4                4           3248.50    2428.447819                 74.755974   \n",
       "\n",
       "   purchase_count_segment                           purchases_timestamp_list  \\\n",
       "0                       1                       [2018-09-15 15:01:37.219186]   \n",
       "1                       2  [2018-10-23 12:01:40.766790, 2018-09-15 17:01:...   \n",
       "2                       2  [2018-11-27 22:02:40.424597, 2018-10-01 16:01:...   \n",
       "3                       2  [2018-11-16 01:02:10.427579, 2018-09-30 00:01:...   \n",
       "4                       2  [2018-11-05 20:01:47.643444, 2018-09-01 03:01:...   \n",
       "\n",
       "  purchases_timestamp_hour_of_day_list  \n",
       "0                                 [15]  \n",
       "1                     [12, 17, 17, 14]  \n",
       "2                      [22, 16, 8, 12]  \n",
       "3                           [1, 0, 11]  \n",
       "4                      [20, 3, 16, 22]  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# aggregate historical data and put the timestamps into a new column\n",
    "period1_timestamp = purchases_period1_history \\\n",
    "    .groupby('customerid')['timestamp'] \\\n",
    "    .apply(list) \\\n",
    "    .reset_index(name='purchases_timestamp_list')\n",
    "\n",
    "period2_timestamp = purchases_period2_history \\\n",
    "    .groupby('customerid')['timestamp'] \\\n",
    "    .apply(list) \\\n",
    "    .reset_index(name='purchases_timestamp_list')\n",
    "\n",
    "# do the same for the timestamp_hour_of_day column created earlier\n",
    "period1_timestamp_hour_of_day = purchases_period1_history \\\n",
    "    .groupby('customerid')['timestamp_hour_of_day'] \\\n",
    "    .apply(list) \\\n",
    "    .reset_index(name='purchases_timestamp_hour_of_day_list')\n",
    "\n",
    "period2_timestamp_hour_of_day = purchases_period2_history \\\n",
    "    .groupby('customerid')['timestamp_hour_of_day'] \\\n",
    "    .apply(list) \\\n",
    "    .reset_index(name='purchases_timestamp_hour_of_day_list')\n",
    "\n",
    "# add newly created columns into the existing dataframes\n",
    "customers_period1_history = pd.merge(customers_period1_history, period1_timestamp, on='customerid')\n",
    "customers_period1_history = pd.merge(customers_period1_history, period1_timestamp_hour_of_day, on='customerid')\n",
    "customers_period2_history = pd.merge(customers_period2_history, period2_timestamp, on='customerid')\n",
    "customers_period2_history = pd.merge(customers_period2_history, period2_timestamp_hour_of_day, on='customerid')\n",
    "\n",
    "customers_period1_history[:5]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we will create new customer features based on the information about purchases times. We can start with the **favorite hour**. The `purchases_timestamp_hour_of_day_list` column yields a sequence of hours of transactions. We can calculate the median of this sequence for each customer and save the result into a new `favorite_hour` column. After that we can sort customers into new segments and create the new `favorite_hour_segment` feature:\n",
    "- segment 1: `favorite_hour` 5-9 (early birds)\n",
    "- segment 2: `favorite_hour` 12-15 (lunch time shoppers)\n",
    "- segment 3: `favorite_hour` 17-22 (night owls)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "# create a new column for the favorite hour\n",
    "customers_period1_history['favorite_hour'] = customers_period1_history['purchases_timestamp_hour_of_day_list'] \\\n",
    "    .apply(np.median)\n",
    "customers_period2_history['favorite_hour'] = customers_period2_history['purchases_timestamp_hour_of_day_list'] \\\n",
    "    .apply(np.median)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA8EAAADhCAYAAADoDLerAAAABHNCSVQ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ss89Uo0YNxzpHjhzRmDFj9Pvvv8vNzU09e/ZU3759FR0drT59+qhz586SVGB62rRpSklJkYeHh2rXrq0333xTKSkp2rFjh9566y25u7urbdu2ev311/Xzzz/LYrHowQcf1EsvvSSr1ap77rlH/fv31+rVq5WVlaXhw4crOTlZv/zyi/z8/PT+++/L29tbv/32m8aPH6+TJ0/KZrMpOjpaUVFR2rhxo8aPHy9vb29lZ2fr008/1ejRo7Vv3z65ubnprrvu0tixY+XmVvAGn4ceekhTp05Vdna2Jk+erAYNGmjPnj3Kzc3Vq6++qrZt2xZYfuPGjcUul5ubq8TERG3evFk2m03NmjVTXFycFi1apO3btysxMVF5eXlq06aNYmNjFRUVpS1btujNN9/U8OHDJUnnzp1TUFCQFixY4Phjy9NPP60+ffrokUceKVDLwoULNWfOHLm5ual27dqaOHGi9u/fX+A8LFy4UGvXri3y2jl69KheffVVHTt2TEeOHFG9evU0ZcoU/fjjj/r222+1bt061ahRQ3369NHMmTO1cuVK2e121atXT2PGjJG/v79+/fVXxcbG6ty5c2rcuLGys7OLbD8rV67UzJkzZbFY5O7urhEjRuiBBx7QmTNnNH78eP3yyy/Ky8tTYGCgRowYIavVqjVr1igxMVFubm668847lZqaqnnz5mnTpk1auXKlzp8/r0OHDqlu3brq06ePPvnkE6Wlpenpp5/WM888I+nCiPa///1v2e123XjjjYqPj1eTJk0UExMjHx8f7d69W3/88YcaN26sd955R0uXLi1wzdauXVsJCQmy2+2SpIEDByo0NLTQ8WVnZ+uFF17Qvn37dP3112vs2LG69dZbtXfvXo0dO1bZ2dnKzMxUQECApkyZIi8vryLbjJ+fX7HXuCRNnTpVy5cv14033qhGjRoVea4l6bPPPtPcuXPl5uamm2++WfHx8br11luLPe7rrrvOsW56erqmTZumM2fOaNSoUYqMjFR2draGDRum33//XTk5ORo3bpxatWpV7DXv4+Pj2N7vv/9eqL/5+OOP9c033ygnJ0fnzp3TyJEj9fDDD6tjx46aPn267rnnHknSsGHD9MADD+jxxx9XQkKC1q9fL3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wBhjzA8//GDuuOMOs2HDhkLn7eGHHzb/+c9/jDHGfP/99+bdd981xhgTExNj/vWvfzlep1deecXMmjXLHD9+3LRu3drRThYvXmxuv/12c+DAAbNo0SLTsmVLc/jwYWOz2UzXrl3N0KFDjc1mM7t27TL33HOPsdlsZuPGjaZ3794mOzvbsd8uXbo4ju/JJ580OTk5Jjc310RGRpqFCxcaYwpes3379jVJSUmOc/7aa68VeU0EBASYLVu2OM5PVFSUMcaYhIQEs3TpUmOMMbm5uSY8PNwkJycX22Yud42npKSYrl27mjNnzpi8vDwzYMAA89RTTxWqJzU11TzyyCPm2LFjxhhjFi1aZLp06WLsdvtlj/tSixYtMgMGDHAc35133ml++uknY8yFa61v377GmOKv+aLO0cXr++DBgyY6OtqcO3fOGGNMUlKSCQ8PN8YYM3XqVPP6668bY4w5efKkad26tTl9+rSZOnWqef75501ubq6x2WwmJibGxMfHG2MutOHp06c79nWxTRtzoV+5eB6io6PNqlWrjDHGnD9/3kRHR5svv/yyUK1PPfWUGTx4sMnPzzfZ2dmmffv2ZvPmzZftT6dNm+ao2xhTYPqpp54yo0aNKrSfP5/np556yrzwwgvGZrOZM2fOmA4dOpj169cXWufSbS9atMi0atXK0be98cYbjn0V17b+bOTIkSYyMtJkZWWZnJwc06dPHzN37twy9beXvr7F9fNHjhwxLVu2NHv27DHGGPP++++b22+/vcjzUtT5AVC1GAkG4ODm5qZJkyape/fu6tChQ5nWDQkJkSQ1aNBAN998swICAiRJDRs2LHBrW8+ePSVJ/v7+6tChg2PkIzMzU/3793csZ7FYtH//fklSixYtCv11X5I2bNigtm3bqkGDBpKkwMBA3XTTTdqxY4csFkuxtaampjpGJmvVqqWkpKTLHpu/v78CAgLUvXt3BQUFKSgoSIGBgYWW++677/Tvf/9bFotFnp6e6tmzp/75z39qwIABkuQYYWvYsKFuv/12x+h4/fr1derUKaWlpWn//v2KjY11bPP8+fP673//qyZNmqhu3bqqV6+eJKlly5aaPHmyoqOj1a5dO/Xr1++yI2eSdMstt+jOO++UJDVr1kxLliwp03KrV6/WmTNnlJqaKknKy8tTnTp1VK9ePf3lL3/R9u3b9f3332vAgAGaNWuWjDFatWqVPvzwQ6Wnpzu237t3bz311FMaNmyYPvvsM0VFRcnd3b1ADevXr1eHDh1Ut25dSXJcGxs3bixwHtatW1fstdOvXz/98MMPmjNnjtLS0rRnzx7de++9hY73//7v/7R9+3b16NFDkmS323Xu3DmdOHFCu3fvVmRkpOOcF3cLdVhYmJ5//nkFBwerffv2eu655xznbPv27Vq4cKGkC6+nJP3www9q0qSJo5107969wLOT99xzj+PY69evrw4dOsjNzU0NGjRwjC6uXr1a+/btc7QpSTp16pROnjwpSXrwwQcdd3TcfvvtRd5i2qVLF40dO1bffvut2rVrp5deeqnI47vjjjt0//33O2p97bXXdObMGQ0fPlzr1q3Thx9+qLS0NGVmZio7O7vYNvPrr78We43/9ttv6tSpk2OUtUePHpo7d26hWr7//nt17dpVN910kyTpscce0/jx43Xw4MFSH/efNWjQwHFtBAQEaNGiRZKKv+Yvp169epo4caKWL1+uffv2aevWrTp79qzjmKKiohQTE6OkpCR17NhRtWrV0nfffadhw4bJw8ND0oW7UIYMGeLYZqtWrS67z+zsbG3evFmnTp1yPE+bnZ2tn3/+WV27di20fNeuXeXu7q6aNWvqr3/9q44dO6bdu3cX25+WpKT6LurYsaPc3Nzk4+OjRo0aleq1ad68uaNvu/POOx23nBfXtorSvXt3x90A3bp106pVq9S2bdtS97eXKq6fb9SokW6//XbHowZPPvmk3nnnnVKdFwBVjxAMoIBbbrlFr732mkaOHOl48y9dCBbGGMd0Xl5egfUuvX364hu5olx665sxRlarVTabTYGBgZoyZYrj/9LT0+Xn56eUlBR5e3sXua1L67l0Xn5+/mVrsFqtBULygQMHVLt27ULbvHiMbm5u+uSTT7R9+3atX79eEyZMUJs2bRQXF1dguxdvKb10Oj8/3zF9aU1F1Wez2XT99dfriy++cMw7evSoatWqpZ9++qnAeWjQoIFSUlK0ceNGbdiwQU8//bTi4uIct3IX5dJbwv/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aff/5ZkvT1119f9k18Udq3b68vv/zScY7+/e9/q1+/fiWud+mx9+zZU7t27dJjjz2mN954Q6dPny5ydG737t3atWuXpAvP47Zs2VI1a9bU2rVrNWTIEHXt2lUWi0Vbt26VzWYrts1c7hp/8MEHlZycrNOnT8tutxcIJ5fq0KGDVqxY4fhU5EWLFpX4DPHlzsHlXO6aL87mzZt199136+mnn1br1q21atUqx3UnSU888YQ+/PBDnT9/Xi1btpR0YfR6/vz5ysvLk91u16effqr27duX+jh8fHzUokULzZkzR9KFQNirVy+tWrWqxG1cdLn+tHbt2tq5c6eMMcrOztbatWtLvd2yKstrU1TbKspXX32l3Nxc5eTkaMmSJerYsWOZ+ts/77eofr5Vq1b69ddfHW168eLFZTxyAFWJP1MBKFJcXJy2bNnimI6OjtYrr7yi0NBQ1a9fX61bty7XdnNyctS9e3fl5eUpLi7O8eFIY8eO1UsvveQYHZ45c2aJowu33XabxowZo+eff142m001atTQ+++/X2gU689effVVvfbaa4qIiJAxRgMHDtTdd9+twYMHKyYmRmvWrFHjxo0dt/gFBASoS5cu6tGjh7y9vVWjRg3HKHDHjh01ceJEx/GMGzdOERERysvL04MPPlimr7/w9PTUjBkzNH78eH300UfKz8/XP/7xD7Vs2bLQ1/JERkZq06ZN6tq1q2rWrKlbbrlFffv2LfW+yuPvf/+7Jk6cqO7du8tms+nOO+90fIXWxVsAL94m3qFDB82YMaPYENyxY0fFxcUVuJX3UnfccYeGDx+uZ599VpLk6+urCRMmKC0trcByTZs2LfbaGTJkiN566y3NmDFD7u7uuv/++x232AcFBemNN96QdOErZzIyMvTEE0/IYrGobt26SkhIkCS98847GjVqlObPn6+GDRuqcePGhWq1Wq2KjY3VK6+84rjLYMKECfL09NTo0aM1fvx4xzXRrl07Pfvss/Lw8NA777yjkSNHys3NTXfffbesVqtjFK80HnzwQT333HN65plnZLFY5OPjo+nTp5cYpC+9Zl955RVNmDBBU6ZMkZubm55//nnVr1+/0DqNGzfW9OnTdeDAAdWpU8dxfoYNG6Y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5+clqterSp5fc3AreyOXp6en42cPDo9D+7Ha7jDGaP3++atasKUk6fvy4vLy8dOLECXl4eDi2abFYKvRYAQC42nA7NAAAVWzevHkaNWqUOnTooOHDh6tDhw7avXu31q1bp99++02StGbNGj366KPKyclRcHCwFi1aJLvdrnPnzikpKalMYdXHx0ctWrTQnDlzJEmnT59Wr169tGrVqsuu5+7urry8vPIfKAAAVyFGggEAqGKRkZHatGmTunbtqpo1a+qWW27R+PHjlZqaqpdeeknGGMeHWnl7e2vgwIEaO3asIiIiVKtWLdWpU0c1atQo0z4TExP1xhtvKCIiQrm5uQoPD9ejjz6qgwcPFrtO06ZN5e7urqioKH3++eeMEgMArgl8OjQAAFe5L7/8Uj4+PgoODpbdbtfQoUPVvn179e7d29mlAQBQ7RCCAQC4yv3yyy969dVXde7cOeXl5alNmzaKjY0t8vlfAABweYRgAAAAAIDL4IOxAAAAAAAugxAMAAAAAHAZhGAAAAAAgMsgBAMAAAAAXAYhGAAAAADgMgjBAAAAAACX8f8AwDhWJ4cRPSoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 1152x216 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def getFavoriteHourSegment(favorite_hour):\n",
    "    \"\"\"\n",
    "    Returns the customer segment\n",
    "    based on the favorite hour.\n",
    "    \n",
    "    Parameters\n",
    "    ----------\n",
    "    favorite_hour\n",
    "        the favorite hour for shopping\n",
    "    \"\"\"\n",
    "    if (favorite_hour >= 5) and (favorite_hour <= 9):\n",
    "        return 1\n",
    "    if (favorite_hour >= 12) and (favorite_hour <= 15):\n",
    "        return 2\n",
    "    if (favorite_hour >= 17) and (favorite_hour <= 22):\n",
    "        return 3\n",
    "    \n",
    "    # default segment for the rest of the customers\n",
    "    return 0\n",
    "\n",
    "# create a new column for the new segmentation based on the favorite hour\n",
    "customers_period1_history['favorite_hour_segment'] = customers_period1_history['favorite_hour'] \\\n",
    "    .apply(getFavoriteHourSegment)\n",
    "customers_period2_history['favorite_hour_segment'] = customers_period2_history['favorite_hour'] \\\n",
    "    .apply(getFavoriteHourSegment)\n",
    "\n",
    "plt.figure()\n",
    "plt.title('Number of customers in newly created segments based on the favorite hour in the period 1:')\n",
    "plt.hist(\n",
    "    x=customers_period1_history['favorite_hour_segment'],\n",
    "    bins='auto',\n",
    "    color='#0504aa',\n",
    "    alpha=0.7,\n",
    "    rwidth=0.85)\n",
    "plt.xlabel('segment')\n",
    "plt.ylabel('# customers')\n",
    "ticks = [0, 1, 2, 3]\n",
    "labels = [0, 1, 2, 3]\n",
    "plt.xticks(ticks, labels)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we will calculate the **regularity of purchases**. We can base this calculation on time intervals between single transactions. We will calculate the standard deviance between these intervals and if it's reasonably small, we can label such transactions as regular. We will take into account the number of transactions as well. It doesn't make any sense to compute the regularity of purchases for customers which have only made one or two purchases so far."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/ondra/.virtualenvs/aiworkshop/lib/python3.6/site-packages/numpy/core/fromnumeric.py:3118: RuntimeWarning: Mean of empty slice.\n",
      "  out=out, **kwargs)\n",
      "/home/ondra/.virtualenvs/aiworkshop/lib/python3.6/site-packages/numpy/core/_methods.py:140: RuntimeWarning: Degrees of freedom <= 0 for slice\n",
      "  keepdims=keepdims)\n"
     ]
    },
    {
     "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>customerid</th>\n",
       "      <th>purchases_price_list</th>\n",
       "      <th>purchases_count</th>\n",
       "      <th>purchases_median</th>\n",
       "      <th>purchases_std</th>\n",
       "      <th>purchases_std_percentage</th>\n",
       "      <th>purchase_count_segment</th>\n",
       "      <th>purchases_timestamp_list</th>\n",
       "      <th>purchases_timestamp_hour_of_day_list</th>\n",
For faster browsing, not all history is shown. View entire blame