Commit 8745fbd1 authored by Weigert, Andreas's avatar Weigert, Andreas
Browse files

added script and data for tutorial 8

parent 462720ba
---
title: 'Tutorial 8: Clustering'
output: html_notebook
editor_options:
chunk_output_type: inline
---
This file is part of the lecture Business Intelligence & Analytics (EESYS-BIA-M), Information Systems and Energy Efficient Systems, University of Bamberg.
```{r Load libraries}
library(dplyr)
library(lubridate)
library(psych)
library(cluster)
library(readr)
```
```{r Read and prepare data}
# read data
consumption <-
customer <-
logins <-
survey <-
portal_points <-
# convert data
# aggregate and calculate data
# Join data together
```
```{r Clustering 1 - A first try with extreme values}
```
```{r Clustering 2 - A second try with untransformed data}
```
```{r Clustering 3 - A third try with transformed data}
```
```{r Determine the right number of clusters}
```
```{r Clustering 4 - Using an hierarchical clustering approach}
```
CustomerID,consumption_2012,billing_days_2012
152133,5477,364
152247,2925,364
152145,2727,364
152304,2692,364
155535,7474,364
150840,5129,364
151665,2115,364
151500,853,364
155958,4629,364
152262,4885,364
152223,5404,364
151905,2035,364
152184,2604,364
155706,4268,364
150693,557,121
152331,2803,364
151812,3283,364
150825,5510,364
150993,5717,364
155859,5717,364
156444,3313,364
151206,2543,364
151128,630,364
150939,4467,364
151575,3943,364
150315,5672,364
150417,4264,304
150222,3593,364
150636,1572,364
152202,3745,364
156252,1472,364
150723,4920,364
155853,3744,364
150672,4408,364
151539,1982,364
151761,2751,364
155844,4441,364
155541,3947,364
151554,5054,364
151329,3117,364
151698,4224,364
150696,3180,364
152052,8455,364
155664,4728,364
151242,6904,364
151404,3547,364
151620,4303,364
152211,3403,364
155310,3143,364
150504,3007,364
150156,2594,182
150348,2594,182
151050,3141,364
151371,6464,364
150699,3538,364
150420,6710,364
150501,1932,364
150567,3302,364
150603,6616,364
150969,4028,364
151926,5330,364
150936,2785,333
151878,3537,243
151131,2444,364
150843,5112,364
155631,5317,364
150855,3347,364
151959,4525,364
150885,5052,364
151464,4500,364
155529,5513,364
152109,3199,364
151296,1926,364
151257,4648,364
151776,9020,364
152070,4326,364
152196,3607,364
155229,1802,364
152058,5765,364
151839,3076,364
151983,6967,364
155331,2603,364
151755,2922,364
155340,3380,364
151227,6639,364
151356,2662,364
152214,2384,364
156033,4623,364
152301,4651,364
151587,1965,364
151902,4191,364
151275,6417,364
151407,3236,364
151215,6074,364
151323,7470,364
152274,5183,364
151410,2856,364
151551,1207,364
152157,3931,364
151362,2803,364
151272,3330,364
151428,3665,304
151767,3113,364
151494,2605,364
151467,9251,364
151521,1745,364
150285,1814,364
151635,6462,364
151860,3004,364
155934,4349,364
152136,1106,364
151836,5762,364
151686,3117,364
155553,4039,364
155772,4799,364
155655,4597,364
150531,2683,364
150834,6400,364
152022,3996,364
150564,5277,364
152097,2267,364
151677,3980,223
151662,5961,364
150606,4994,364
152178,2667,364
150942,1733,364
151548,2617,364
151659,3069,364
150660,1485,364
151125,6118,364
152094,8118,364
151599,5284,364
150633,1423,208
152181,3832,364
151095,3134,364
151167,5165,364
151770,5042,364
155793,2610,364
150666,2619,364
155271,3e3,364
150405,2983,364
150951,1646,273
150243,3014,364
151200,4268,364
150828,5563,364
151401,1533,364
152367,1870,364
151743,4468,364
150690,3437,364
151779,3280,364
151035,4450,364
151044,3400,364
150819,5204,364
151497,2739,364
150702,2894,364
152013,5370,364
150747,4379,364
152160,1550,364
150585,6505,364
150789,6167,364
151476,3760,364
150705,8315,364
150981,4367,364
151731,1023,364
151821,1993,364
150498,6022,364
150642,4368,364
151566,3858,364
150651,2664,364
150732,5194,364
150657,2866,364
150609,3735,364
151224,4667,364
150927,4605,364
152139,4229,364
155508,5166,364
150288,6734,364
151971,4636,364
152163,3454,364
150669,6391,364
151302,2942,364
150810,5605,364
151230,5101,364
151104,3650,364
150537,4937,364
151290,3257,364
155589,6707,364
150822,2955,364
151914,3947,364
155196,5071,364
155409,3625,364
150591,2624,364
150786,2180,364
152049,3505,364
150516,2931,364
155886,4994,364
151947,3273,364
152256,4609,364
150483,2808,364
150393,9218,364
151530,2600,364
151221,2594,364
151326,6432,364
152091,3732,364
151953,2190,364
150774,3570,364
151974,1289,364
156282,2867,364
151041,1285,364
151260,4446,364
151512,4680,364
151059,3979,364
151584,1646,364
150615,4211,364
152088,1509,273
150570,4706,364
150990,1689,212
150762,3776,364
152205,4633,364
151314,1113,364
152172,2979,364
150600,3254,364
151848,3597,364
150342,6323,364
151692,5863,364
155826,8477,364
151713,3842,364
151344,1912,273
151014,1550,364
150576,3361,364
151986,4757,364
155964,1100,364
151248,2212,364
150426,4097,364
151188,1094,364
151170,6190,364
151149,4845,364
151473,7121,364
151236,5276,364
152130,3612,364
151209,4116,364
151038,5813,364
152295,1787,364
151077,7616,364
150873,4774,364
151869,6974,364
152277,6613,364
151629,6962,364
150561,9235,364
150582,4858,364
155526,2921,364
150390,5058,364
155643,2902,364
151899,3927,364
150510,5505,364
151602,6554,364
150648,2486,364
151023,2931,364
156222,990,364
151470,2313,364
152040,3706,364
151341,3261,364
150414,4711,364
150588,7494,364
151173,1675,364
151866,9257,364
152355,6813,364
152358,6813,364
151881,3793,364
151941,4679,364
152028,3958,364
151080,6085,364
150597,2425,364
150687,5736,364
151482,5299,364
151353,6046,364
151917,4016,364
155364,4012,364
155790,4976,364
152217,3048,182
152115,2433,364
151518,4103,364
151185,4574,364
152319,5071,364
150960,5171,364
151311,2868,364
150876,3763,364
151710,6308,364
151560,2819,364
151527,2890,364
150543,4485,364
150081,1031,364
150078,941,364
150135,941,364
155955,1111,364
155892,1111,364
150612,5711,364
155460,2288,364
150618,1853,364
155223,2433,364
150972,5578,364
152328,3729,364
150750,3411,182
151845,1303,364
151533,2634,364
155856,7429,364
150753,4395,364
155220,7757,364
151596,2552,364
155877,8757,364
151704,4272,364
151107,2245,364
150882,6659,364
151626,1608,364
151965,5064,364
151305,2366,364
151515,3996,364
151002,3608,364
152121,2554,364
151824,5185,364
155277,4439,364
150639,3444,364
152016,4662,364
151887,2450,364
155241,4631,364
150813,4024,364
151593,1453,288
151896,3918,364
151218,3397,364
151569,2341,364
151830,5504,333
151719,1565,364
150783,2268,364
151590,3859,364
155703,1991,364
151833,1738,364
155343,5036,364
155448,6432,364
151146,4550,364
150579,3719,364
151815,4069,364
150801,4471,364
156e3,5006,364
152043,6254,364
151158,7180,364
152106,6903,364
151932,3745,364
155415,8287,364
151029,3198,364
152190,3927,364
150594,2573,364
152307,5399,364
150492,4748,364
152151,3746,364
155559,5172,364
156435,5172,364
155547,3047,364
152073,6863,364
151791,2607,364
152382,2461,364
155208,4325,364
151164,3837,364
153810,1766,364
151155,1866,364
151017,6474,364
154956,4465,364
150954,6617,364
151056,3443,364
151047,4120,364
151122,2115,364
155436,5371,364
155658,2064,364
155910,3217,364
151890,3368,364
151152,3891,364
151644,6525,364
152298,3940,364
151284,3475,364
150852,4496,364
150759,2988,364
150918,5081,364
151452,2376,364
151893,6914,364
151110,3946,364
150675,8801,364
151335,3467,364
151695,2935,364
151998,6120,364
151083,2657,364
151863,3176,364
151137,3705,364
150984,1868,364
151803,6277,364
152061,869,364
151485,2793,364
150624,1355,364
152340,686,364
155373,5597,364
152220,2809,364
151935,6527,364
150684,2355,364
152187,6610,364
151536,7189,364
155346,2207,364
151524,4896,364
151251,4625,364
150489,4061,364
151212,3763,364
152118,4908,364
150111,7024,364
150528,7421,364
150912,8601,364
152253,1657,364
151581,2030,364
150258,1598,182
150357,1598,182
151764,3381,364
151923,3655,364
151179,861,364
151365,4462,364
150861,2534,364
151995,3016,364
150846,3540,364
150837,2798,364
151140,3758,364
150897,4264,364
151605,2069,364
150681,3982,364
151392,5169,364
151239,2722,364
151368,4869,364
151746,2463,364
151911,4813,364
151716,2919,364
150780,4019,364
151854,5242,364
150555,639,364
151572,1785,364
152352,2459,364
150888,790,364
151293,2223,364
151563,3047,364
155421,2562,364
150966,2616,364
151437,2712,364
150276,4129,364
152370,6420,364
151479,3018,364
155325,1701,364
151374,4939,364
151119,7145,364
151266,1671,364
151269,4142,364
150816,1332,364
150480,2319,364
156315,9059,364
151074,6077,364
150924,3886,364
155988,702,364
150330,1838,364
150621,3127,364
150507,2643,364
152235,3101,364
152349,1233,364
155394,1504,183
151299,456,129
150363,2209,364
150795,7450,364
151440,3322,364
151101,2863,364
150933,4097,364
151740,3468,364
151008,7550,364
155556,6238,364
151488,4887,364
151281,2024,364
151347,4258,364
151737,3077,364
151332,3092,364
150630,3295,364
151425,2844,364
152142,3236,364
151068,3611,364
151617,4609,364
151929,2855,364
150558,1694,364
150366,2461,364
151884,3650,364
150312,1415,182
150663,8843,364
150246,4293,364
155274,2065,364
155550,1183,152
150549,2259,364
155979,5460,364
154713,1258,304
151389,2598,292
152001,1859,364
151806,1949,320
151944,3356,364
152238,975,273
151734,2451,318
150975,1082,364
152286,315,120
151062,1102,182
152325,1025,182
150552,1620,182
150804,1607,212
151632,2029,183
155730,3377,243
151950,761,121
151089,1805,182
150522,967,183
150738,3155,183
151872,927,183
152103,800,152
152199,650,152
152376,1082,212
150909,915,169
151092,861,152
150546,737,134
150921,1162,109
150999,531,120
152037,3063,120
151674,1273,121
152241,1584,101
150729,3813,364
151134,3027,364
152100,2290,364
150915,3322,364
151542,2123,273
150141,3527,364
152124,2403,364
152112,1539,364
151338,4842,364
150864,4765,364
155691,1301,364
151728,1789,364
151992,1276,364
151647,1069,364
150879,6796,364
151254,3973,364
155469,1213,364
155523,857,364
151419,1198,183
152079,1978,364
151380,3893,364
151398,895,364
151800,861,364
151509,1673,364
151653,3501,364
151920,5102,364
151413,1390,364
151191,1920,364
150987,3203,364
151668,6503,364
155874,2816,364
150894,1551,364
151086,4314,364
152055,4558,364
155676,7631,364
151827,2696,243
151359,3671,364
151758,2826,364
150468,2737,364
151656,2578,364
152025,926,364
155973,6589,364
151680,3209,364
150978,4539,364
151683,1240,364
152250,3231,364
155280,2360,364
150540,2515,364
151383,3405,364
150870,4632,364
151980,4253,364
151752,3196,364
155637,3196,364
154251,5241,364
150867,2071,364
151956,2209,364
152046,4468,364
155412,8788,364
150534,3743,364
150831,3085,364
152361,1947,364
152364,1947,364
152259,9084,364
155238,1027,243
151350,3781,364
151005,6652,364
152082,1138,364
155496,1964,333
150726,2107,364
150444,4517,364
150930,3241,364
151386,3935,364
150180,1210,182