Full text
i
Unsupe ised Lea ning Applied o he
Segmen a ion o Use s o Online Gambling
Pla o ms in Po ugal
Leona do Mo a Pe azzo Lannes
The e ec s o he Co id-19 Pandemic on Use
Beha io and Segmen a ion
P ojec Wo k p esen ed as pa ial equi emen o ob aining
he Mas e ’s deg ee in Ad anced Analy ics
ii
NOVA In o ma ion Managemen School
Ins i u o Supe io de Es a ís ica e Ges ão de In o mação
Uni e sidade No a de Lisboa
UNSUPERVISED LEARNING APPLIED TO THE SEGMENTATION OF
USERS OF ONLINE GAMBLING PLATFORMS IN PORTUGAL
The E ec s o he Co id-19 Pandemic on Use Beha io and Segmen a ion
by
Leona do Mo a Pe azzo Lannes
P ojec Wo k p esen ed as pa ial equi emen o ob aining he Mas e ’s deg ee in Ad anced
Analy ics
Ad iso : Mau o Cas elli, Ph.D.
Co Ad iso : Fe nando Pe es
No embe 2021
iii
DEDICATION
I would like o dedica e his hesis o my wonde ul amily. To my wi e and daugh e , who we e always
so suppo i e and unde s anding du ing he ime in which I was commi ed o my s udies. And o my
mo he and a he , who ha e always encou aged me o pu sue my objec i es in li e. Thank you.
i
ACKNOWLEDGEMENTS
I would like o hank my hesis ad ise s, Fe nando Pe es, and Mau o Cas elli. Bo h we e always
a ailable when I needed guidance and cons an ly helped me wi h in e es ing insigh s o imp o e his
wo k.
ABSTRACT
Online gambling has become an inc easingly ele an ac i i y in he las yea s and is now a ailable
h ough a wide a ie y o echnologies and pla o ms. This can be seen as an impo an addi ion o he
en e ainmen indus y since i has he po en ial o gene a ing g ea economic impac s. The
phenomenon, howe e , is no ee o conce ns conside ing ha , like in any o he ype o gambling
ac i i ies, online gamble s a e suscep ible o de eloping beha io al addic ion. This has become a
eason o conce n o many go e nmen al bodies a ound he wo ld which a e s udying his issue due
o i s social impac s on he popula ion. In his con ex machine lea ning algo i hms can be applied o
unde s and he beha io o online gamble s and o iden i y he cha ac e is ics o gambling addic ion.
This wo k p ojec has he objec i e o segmen izing use s o online gambling pla o ms in Po ugal
acco ding o he endency o hese use s o ha e compulsi e gambling beha io . I also in ends o
e alua e he impac s o he Co id-19 pandemic on online gambling addic ion by analyzing changes in
use segmen a ion du ing he ini ial pe iods o he pandemic. This will be done by applying
unsupe ised lea ning algo i hms, speci ically K-Means and Sel -O ganizing Maps and by compa ing
use clus e s om he yea s 2019 and 2020.
KEYWORDS
A i icial In elligence; Big Da a; Clus e ing; Da a Science; Machine Lea ning; Segmen a ion;
Unsupe ised Lea ning
i
INDEX
1. In oduc ion .................................................................................................................. 1
1.1. Objec i es .............................................................................................................. 2
1.2. Resea ch Ques ions ............................................................................................... 2
1.3. S uc u e ................................................................................................................ 3
2. Theo e ical Backg ound ................................................................................................ 4
2.1. A i icial In elligence and Machine Lea ning ......................................................... 4
2.1.1. Supe ised Lea ning ....................................................................................... 4
2.1.2. Unsupe ised Lea ning ................................................................................... 4
2.1.3. Semi-supe ised Lea ning .............................................................................. 5
2.1.4. Rein o cemen Lea ning ................................................................................. 5
2.2. Big Da a .................................................................................................................. 5
2.3. Da a P epa a ion and P ep ocessing ..................................................................... 6
2.3.1. Ou lie T ea men ........................................................................................... 6
2.3.2. Missing Values ................................................................................................ 8
2.3.3. Rescale Da a ................................................................................................... 8
2.3.4. Fea u e Selec ion ............................................................................................ 9
2.3.5. Fea u e Enginee ing ..................................................................................... 11
2.4. Clus e ing Techniques ......................................................................................... 12
2.4.1. Hie a chical Me hods ................................................................................... 12
2.4.2. Pa i ional Me hods...................................................................................... 14
2.4.3. Va ia ions o K-Means .................................................................................. 19
2.4.4. Sel -O ganizing Maps (SOM) ........................................................................ 20
2.4.5. Combina ion Me hods.................................................................................. 22
2.5. P o iling ................................................................................................................ 22
2.5.1. Rada Cha ................................................................................................... 23
3. Clus e Analysis ........................................................................................................... 24
3.1. Clus e Analysis o 2019 Da a ............................................................................ 25
3.1.1. 2019 Da a Loading and Ini ial Analysis ......................................................... 25
3.1.2. 2019 Da a P epa a ion ................................................................................. 29
3.1.3. Implemen a ion o Clus e ing Techniques o 2019 Da a ............................. 35
3.1.4. Model Selec ion o 2019 Da a .................................................................... 46
3.1.5. Analysis o he Selec ed Model and P o iling ............................................... 48
ii
3.2. Clus e Analysis o 2020 Da a And Compa ison wi h Da a F om 2019 ............. 51
3.2.1. 2020 Da a Loading and P epa a ion ............................................................. 51
3.2.2. Applica ion o he Clus e ing Model o he 2020 Da a ................................ 52
3.3. Clus e Shi s Be ween 2019 and 2020 ............................................................... 55
4. Resul s and Discussions .............................................................................................. 57
4.1. Answe ing Resea ch Ques ions ........................................................................... 58
5. Recommenda ions o Fu u e Wo k ........................................................................... 59
6. Bibliog aphy ................................................................................................................ 60
iii
LIST OF FIGURES
Figu e 2. 1: Boxplo .................................................................................................................... 7
Figu e 2. 2: The Cu se o Dimensionali y ................................................................................. 10
Figu e 2. 3: Hea map o Co ela ion Ma ix ............................................................................. 11
Figu e 2. 4: Dend og am .......................................................................................................... 12
Figu e 2. 5: K-Means Algo i hm ................................................................................................ 15
Figu e 2. 6: Elbow G aph .......................................................................................................... 16
Figu e 2. 7: Silhoue e Analysis o K-Means on sample da a wi h K=2 .................................. 17
Figu e 2. 8: Silhoue e Analysis o K-Means on sample da a wi h K=6 .................................. 18
Figu e 2. 9: S uc u al model o SOM ....................................................................................... 20
Figu e 2. 10: Neu ons o he Ou pu Laye Space .................................................................... 21
Figu e 2. 11: Example o a Rada Cha .................................................................................... 23
Figu e 3. 1: Dis ibu ion o Be ing Volume in 2019 ................................................................ 24
Figu e 3. 2: Va ia ion o a ibu es du ing 2019 ...................................................................... 27
Figu e 3. 3: Pea son Co ela ion Ma ix o Da ase Va iables ................................................. 32
Figu e 3. 4: Boxplo s o Selec ed Va iables .............................................................................. 34
Figu e 3. 5: Py hon code o Ou lie T ans o ma ion ............................................................... 35
Figu e 3. 6: Elbow G aph o Model 1 ....................................................................................... 36
Figu e 3. 7: Elbow G aph o Model 2 ....................................................................................... 37
Figu e 3. 8: Elbow G aph o Model 3 ...................................................................................... 39
Figu e 3. 9: Elbow G aph o Model 4 ....................................................................................... 40
Figu e 3. 10: Elbow G aph o Model 5 .................................................................................... 41
Figu e 3. 11: Elbow G aph o Model 6 .................................................................................... 42
Figu e 3. 12: Elbow G aph o Model 7 .................................................................................... 43
Figu e 3. 13: BMU Hi s View o Model 8 ................................................................................. 45
Figu e 3. 14: Hi s Maps o Model 8 ......................................................................................... 45
Figu e 3. 15: Silhoue e Plo o Model 6 (wi h 6 clus e s) ...................................................... 47
Figu e 3. 16: Silhoue e Plo o Model 7 ................................................................................. 48
Figu e 3. 17: Dis ibu ion o Clus e 4 by En i y ....................................................................... 50
Figu e 3. 18: Elbow G aph o Model 7 (2020)......................................................................... 53
ix
LIST OF TABLES
Table 3. 1: Lis o Va iables in 2019 CSV File ............................................................................ 25
Table 3. 2: Numbe o eco ds o each En i y .......................................................................... 26
Table 3. 3: A e age Balance wi h Ou lie s ............................................................................... 28
Table 3. 4: A e age Balance wi hou ou lie s .......................................................................... 28
Table 3. 5: New Fea u es .......................................................................................................... 29
Table 3. 6: A ibu es o agg ega ed da ase ........................................................................... 30
Table 3. 7: Dis ibu ion o use s acco ding o equency o play ............................................. 31
Table 3. 8: Pe cen iles o AMOUNT and BALANCE Va iables ................................................... 33
Table 3. 9: Cen oids o Model 1 .............................................................................................. 37
Table 3. 10: Cen oids o Model 2 ............................................................................................ 38
Table 3. 11: Cen oids o Model 3 ............................................................................................ 39
Table 3. 12: Cen oids o Model 4 ............................................................................................ 40
Table 3. 13: Cen oids o Model 5 .......................................................................................... 41
Table 3. 14: Cen oids o Model 6 wi h 4 Clus e s.................................................................. 42
Table 3. 15: Cen oids o Model 6 wi h 5 Clus e s.................................................................. 42
Table 3. 16: Cen oids o Model 6 wi h 6 Clus e s.................................................................. 42
Table 3. 17: Cen oids o Model 7 .......................................................................................... 44
Table 3. 18: Cen oids o Model 8 .......................................................................................... 46
Table 3. 19: Silhoue e Sco es o he Models .......................................................................... 46
Table 3. 20: Cen oids o Model 7 .......................................................................................... 48
Table 3. 21: Numbe o Reco ds in Each Clus e o Model 7 ................................................... 49
Table 3. 22: Lis o P o iles ....................................................................................................... 49
Table 3. 23: P opo ional Dis ibu ion o Clus e s by En i y .................................................... 50
Table 3. 24: Dis ibu ion o use s acco ding o equency o play (2020) ............................... 52
Table 3. 25: Cen oids o Model 7 (2020) ............................................................................... 53
Table 3. 26: Numbe o Reco ds in Each Clus e o Model 7 (2020) ........................................ 53
Table 3. 27: Lis o P o iles (2020) ............................................................................................ 54
Table 3. 28: P opo ional Dis ibu ion o Clus e s by En i y (2020) ......................................... 54
Table 3. 29: Clus e Shi s ......................................................................................................... 55
6
2.3. DATA PREPARATION AND PREPROCESSING
Fo he execu ion o any da a ela ed p ojec ed i is pi o al o pe o m ce ain p ocedu es ha will
gua an ee i s quali y. The quali y o da a can be measu ed by nume ous ac o s such as accu acy,
comple eness, and consis ency, all o which can be a ec ed by aul y collec ion ins umen s, human
o compu e e o s, echnology limi a ions o una ailabili y (Han, Kambe , & Pei, 2012). Besides he
p ocedu es o imp o e da a quali y, o he ac ions migh be necessa y o ensu e da a usabili y such as
s anda diza ion and dimensionali y educ ion.
2.3.1. Ou lie T ea men
Ou lie s can be hough o as obse a ions wi h signi ican ly de ia ing cha ac e is ics (Madsen, 2018).
In a ML model, i hese obse a ions a e e y ex eme, hey migh in e e e inapp op ia ely wi h he
esul s gene a ed by he model. In an unsupe ised lea ning model, o ins ance, ou lie s can gene a e
indi idual clus e s o only an isola ed g oup o obse a ions. In supe ised lea ning models, ou lie s
can cause se e e de ia ions in he model’s p edic ions. Thus, i is impo an o pe o m some so o
ou lie ea men o ensu e he da a is app op ia e o aining a model.
Since he de ini ion o wha is a signi ican de ia ion is subjec i e, he e a e a ew me hods o deal
wi h ou lie de ec ion. Depending on wha he assump ions a e, ega ding he de ini ion o ou lie s
e sus he es o he da a, ou lie de ec ion can be classi ied in wo ypes: p oximi y-based me hods,
and s a is ical me hods (Han, Kambe , & Pei, 2012). The o me , conside s objec s as ou lie s when
hei locali y is spa sely popula ed (Agga wal, 2017). The la e , applies simple and powe ul s a is ical
echniques o he sc eening o ou lie s (Alam, 2020). Fo he pu poses o his p ojec , conside ing
ha i will be mo e ele an o iden i y ex eme alues, s a is ical me hods will be discussed a mo e
leng h and wo speci ic me hods will be de ailed.
The Z-Sco e is a pa ame ic ou lie de ec ion me hod ha assumes a gaussian dis ibu ion o he da a
and measu es how dis an he obse a ion is om he mean (measu ed in s anda d de ia ions)
(Widmann & Heine, 2018). In his me hod alues ha ha e a Z-Sco e highe o lowe han
p ede e mined limi s a e conside ed ou lie s. The Z-Sco e is calcula ed wi h he ollowing o mula:
The Boxplo me hod is non-pa ame ic s a is ical me hod o iden i ying ou lie s, since i does no
assume he da a has a no mal dis ibu ion. I explo es he concep o in e qua ile ange (IQR) which
is he di e ence be ween he 1s qua ile (25 h pe cen ile) and 3 d qua ile (75 h pe cen ile) o he
da a (Alam, 2020). Values g ea e han he uppe bound o smalle han he lowe bound a e
conside ed ou lie s. These bounda ies can be calcula ed wi h he ollowing o mulas:
7
uppe bound = Q3 + 1,5 * IQR
lowe bound = Q1 – 1,5* IQR
Whe e Q1 and Q3 ep esen he alues o he 1s and 3 d qua iles o he da a and IQR ep esen s he
di e ence be ween Q1 and Q3.
The Boxplo me hod is conside ed he de aul me hod o iden i y ou lie s in uni a ia e da a (Madsen,
2018). I has a g aphical ep esen a ion ha helps unde s anding hese concep s and i s bounda ies.
This can be isualized in Figu e 2.1.
Figu e 2. 1: Boxplo
(Gala nyk, 2018)
Iden i ying he ou lie s, howe e , is jus he i s s ep in ou lie ea men . The nex s ep is deciding
wha o do wi h hese ou lie s. And in his case, he e a e h ee main possibili ies o conside (Bi ke ,
2019):
1. Keep he ou lie s.
2. Remo e he ou lie s.
3. Change hei alues o some hing ha be e ep esen s he da a, such as imming ex eme
alues and eplacing hem by pe cen iles (Bi ke , 2019).
The choice o one o hese al e na i es may g ea ly impac a p ojec and he decision mus ake in o
conside a ion he speci ici ies o he da a a hand.
8
2.3.2. Missing Values
Some imes he da a ha has been made a ailable o analysis has some missing alues and hese could
be p esen in jus a ew obse a ions o , e en, in all he obse a ions o he da ase . This anomaly can
be p esen in one o mo e ea u es and may cause ouble since some machine lea ning me hods do
no wo k wi h missing ea u es (Gé on, 2019). O he me hods migh gene a e inconsis en esul s i
he p opo ion o da a wi h missing alues is ex emely ele a ed.
To deal wi h his p oblem he e a e di e en al e na i es:
1. Dele e all he eco ds (obse a ions) o he da ase ha ha e missing alues in a leas one o
hei a ibu es.
2. Dele e all he a ibu es in he da ase ha ha e missing alues in a leas one o he
obse a ions.
3. Impu e he missing alues p esen in he da ase acco ding o some so o c i e ion. In his
case he same c i e ion can be applied o all a ibu es, o i can be analyzed case by case, in
o de o apply he app op ia e changes o each one.
Wi h espec o his las al e na i e, he e a e some possibili ies in which missing alues can be
impu ed. Fi s ly, i is possible o ill in missing alues using s a is ical p ope ies such as mean, median
o mode. I is also possible o ill in missing alues by applying algo i hms ha sea ch o he eco ds
ha a e closes o he one ha has missing alues. And inally, eg ession can be applied by conside ing
he missing alues as dependen a iables.
2.3.3. Rescale Da a
I is common o he a ious a ibu es o a da ase o be in di e en scales. Howe e , mos machine
lea ning algo i hms wo k be e i all ea u es a e in he same scale. O he wise, he algo i hm could
conside a ew o he a ibu es as mo e ele an o he p oblem jus because i has na u ally highe
numbe s han some o he o he ea u es when, in ac , some imes i could be qui e he opposi e.
Fo his eason, he e a e some al e na i es h ough which da a can be escaled.
1. No maliza ion: escales all he a ibu es o a ange be ween 0 and 1 (B ownlee, 2016). The
ollowing o mula de ines his kind o ans o ma ion:
𝑋′= 𝑋− 𝑋
𝑋 𝑋
Whe e Xmin and Xmax co espond o he minimum and maximum alues encoun e ed in he
da ase .
9
2. S anda diza ion: ans o ms a ibu es ha ha e a Gaussian dis ibu ion in o a s anda d
Gaussian Dis ibu ion wi h a mean o 0 and a s anda d de ia ion o 1 (B ownlee, 2016). The
ollowing o mula de ines his kind o ans o ma ion:
𝑋′=𝑋− µ
𝜎
Whe e µ is he mean o he alues and σ is he s anda d de ia ion.
The choice o which ype o da a ans o ma ion o apply is no always simple. No maliza ion is usually
be e when he da a does no ollow a Gaussian Dis ibu ion and since S anda diza ion does no ha e
bounda ies, i will no a ec ou lie s. Anyhow, some imes i is necessa y o apply bo h ans o ma ions
o he da a and compa e he pe o mances (Bhanda i, 2020).
2.3.4. Fea u e Selec ion
F equen ly, he excess o ea u es in a da ase is p ejudicial o machine lea ning models. I is he
opposi e o wha happens wi h he numbe o obse a ions, whe e he algo i hms bene i om ha ing
mo e da a a ailable. This p oblem is e e ed o as he Cu se o Dimensionali y, meaning ha i can be
necessa y o pe o m ea u e selec ion in o de e ain only he mos ele an ea u es o he pu poses
o aining a model (Gé on, 2019).
The cu se o dimensionali y a ises om he ac ha i ele an ea u es can make i mo e di icul o
he algo i hms o iden i y in e es ing pa e ns since he da a becomes spa se . These pa e ns would,
o he wise, be mo e anspa en in a lowe dimensional space (Pa el, 2019). Also ele an is he ac
ha an exagge a ed numbe o ea u es can make he algo i hm unbea ably compu a ionally
expensi e.
Speci ically o unsupe ised lea ning echniques, he addi ion o mo e dimensions o he da a can
make e e y obse a ion in he da ase seem equidis an om all he o he s, since mos algo i hms use
dis ance measu es o iden i y simila i ies in he da a (Yiu, 2019). This makes i ha de o iden i y any
signi ican clus e s in he da a.
Figu e 2.2 below is a simple example o his since i demons a es ha wi h only one dimension (one
ea u e) i is e y clea ha he da a can be di ided in o wo clus e s. Howe e , when a new ea u e is
conside ed, each o he da a poin s seem o be isola ed om he o he s and o m a clus e o hei
own.
10
Figu e 2. 2: The Cu se o Dimensionali y
One me hod o e alua ing a ibu es ha can be dis ega ded is o conside he co ela ion be ween
each o he ea u es o he da ase . A ibu es can be conside ed edundan i hey can be de i ed
om ano he se o a ibu es (Han, Kambe , & Pei, 2012). I a da ase has a g ea numbe o co ela ed
a ibu es, ML algo i hms ha a e applied o i migh su e bias owa ds hose a ibu es and hey
could possibly end up con ibu ing mo e o he esul s han wha would be app op ia e.
Howe e , in o de o pe o m his ype o e alua ion i is necessa y o quan i y he co ela ions
be ween each pai o a iables. This p ocess mus ake in o conside a ion he ypes o a ibu es ha
a e p esen in he da ase . Fo he pu poses o his p ojec only wo ypes o a ibu es will be
conside ed: ca ego ical and con inuous alues. The o me , ep esen s alues ha ha e a ini e
numbe o dis inc ca ego ies such as educa ion le el o gende and can be ep esen ed ei he by
wo ds o numbe s. The la e , ep esen s alues ha can ha e an in ini e numbe o alues such as
sala y o p ice.
When analyzing co ela ion be ween a ibu es, di e en app oaches mus be applied, depending on
he ypes o each one.
- Co ela ion be ween wo ca ego ical a ibu es: A s a is ical es named Chi-squa ed es is
applied o iden i y simila i ies o di e ences (Kuma , 2021)
- Co ela ion be ween con inuous and ca ego ical a ibu es: I he ca ego ical a ibu e is
bina y, a s a is ical es named T- es mus be applied. I he ca ego ical a iable can ha e mo e
han wo possible alues, hen an ANOVA (Analysis o Va iance) es mus be applied (Kuma ,
2021).
- Co ela ion be ween wo con inuous a ibu es: In his case, co ela ion s a is ical es s can be
used. The mos common echniques a e Pea son Co ela ion and Spea man Rank Co ela ion,
bo h o which de ine co ela ion alues be ween [-1,1], whe e p oximi y o 1 deno es posi i e
co ela ion and p oximi y o -1 deno es nega i e co ela ion (Kuma , 2021). A posi i e
co ela ion indica es ha when one a ibu e inc eases, so does he o he . A nega i e
co ela ion indica es ha when one a ibu e inc eases, he o he dec eases. These
co ela ion alues can all be iewed simul aneously h ough wha is e e ed o as a hea map
o co ela ion ma ix, as showed in Figu e 2.3, below. This ype o isualiza ion indica es
11
h ough he in ensi y o he colo s how s ong is he co ela ion be ween each pai o
a ibu es.
Figu e 2. 3: Hea map o Co ela ion Ma ix
(Kho, 2019)
2.3.5. Fea u e Enginee ing
Fea u e enginee ing is a mechanism by which new a ibu es a e c ea ed based on he ones ha a e
al eady a ailable. This is some hing ha could be pi o al in some scena ios since machine lea ning
algo i hms a e only as good as he ea u es ha enable i o sepa a e he da a poin s in he ea u e
space (Pa el, 2019).
The e a e many possibili ies o conside in he c ea ion o new a ibu es. Mos o hese op ions e e
o he gene a ion o ca ego ical a iables, such as in he ollowing examples:
- The p e ix o a pe son’s name can be u ilized o de e mine he gende o ha pe son.
- Ci y names can be g ouped in o egions o coun ies.
- Time o day can be used o seg ega e he da a in o pe iods o he day such as mo ning,
a e noon, and nigh .
- Da es can be sepa a ed in o weekdays and weekends.
- Con inuous alues can be agg ega ed in o g oups o delimi ed bins, each one ep esen ing a
ca ego y.
None heless, ea u e enginee ing can also be applied o c ea e new con inuous a iables. One example
would be he de e mina ion o he age o ime o usage o an obse a ion, based on a bi hday da e
o any o he aw da e.
12
Finally, ea u e encoding is a p ocess in which ca ego ical a ibu es a e ans o med in o nume ical
a iables. This is necessa y because mos ML algo i hms do no wo k well wi h ca ego ical a iables
(Kuma , Fea u e Enginee ing — deep di e in o Encoding and Binning echniques, 2020). As an example,
in a da ase whe e one o he a ibu es ep esen s gende , he wo ds Male and Female would be
subs i u ed by he numbe s 0 and 1.
2.4. CLUSTERING TECHNIQUES
Clus e ing echniques ha e he objec i e o classi ying obse a ions o da a i ems in o g oups (clus e s)
based on simila i ies (Jain, Mu y, & Flynn, 1999). I is use ul in explo a o y pa e n analysis and ML
si ua ions ha in ol e segmen a ion and pa e n classi ica ion (Jain, Mu y, & Flynn, 1999). As such,
hese echniques a e app op ia e o unsupe ised lea ning p oblems, ha is, si ua ions in which he
da a has no been p e iously labeled.
The e a e a g ea a ie y o clus e ing echniques ha ha e been de eloped and es ed. The choice o
he bes echnique o a speci ic p oblem depends on he cha ac e is ics o he p oblem and o he
da a o be used. Th ee common clus e ing me hods will be discussed in his sec ion: Hie a chical
Me hods, Pa i ional Me hods and Sel -O ganizing Maps.
2.4.1. Hie a chical Me hods
Hie a chical me hods o da a clus e ing sepa a e he da a in o g oups a di e en le els ha ep esen
a hie a chy o a “ ee” o clus e s. This ype o echnique is use ul o da a summa iza ion and
isualiza ion since each clus e can be di ided in o smalle subg oups o g ouped up wi h simila g oups
(Han, Kambe , & Pei, 2012).
The implemen a ion o hie a chical clus e ing does no equi e a p e ious de ini ion o he numbe o
clus e s he da a should be di ided in o. This ype o me hod wo ks by building a dend og am, an
upside-down ee, in which he lea es, a he bo om, ep esen he indi idual ins ances o a da ase .
An i e a i e p ocess joins he lea es as i mo es e ically up he ee, based on how simila hey a e
o each o he and e en ually all he ins ances will be linked oge he (Pa el, 2019) as can be seen on
Figu e 2.4 below.
Figu e 2. 4: Dend og am
13
Since hie a chical clus e ing does no ha e a p ede ined numbe o clus e s, be o e he
implemen a ion o he me hod, his decision can be made based on he dend og am. Jus by isually
inspec ing he dend og am one can ha e an in ui ion o how he da a is dis ibu ed. In he abo e
example, in Figu e 2.4, a ho izon al ed line symbolizes an assump ion o how he clus e s could be
de ined. In his case, he ed line c osses i e e ical lines and each o hese e ical lines ep esen
one clus e . As his ed line mo es highe up he ee his would gene a e a smalle numbe o clus e s
bu wi h mo e elemen s is each o hose clus e s. On he con a y, i he ed line mo ed o lowe
posi ions in he ee, i would gene a e a g ea e numbe o clus e s bu wi h less elemen s in each
one.
The implemen a ion o hie a chical clus e ing can be execu ed in wo o ms:
- Di isi e Clus e ing: his is a op-down echnique in which, ini ially, all poin s o he da ase
belong o he same clus e . A ecu si e implemen a ion g adually spli s he da apoin s as one
mo es down he hie a chy (Kuma , 2020).
- Agglome a i e Clus e ing: his is a bo om-up echnique in which, ini ially, each da a poin
ep esen s a clus e . The implemen a ion o his echnique g oups hese poin s in o clus e s
as one mo es up he hie a chy (Kuma , 2020).
One impo an aspec o hie a chical me hods is he de ini ion o how o g oup o sepa a e da a poin s
in o clus e s. Whe he using agglome a i e o di isi e clus e ing, i is necessa y o measu e he
dis ance be ween wo clus e s (Han, Kambe , & Pei, 2012). This is done based on how close he da a
poin s a e o each o he . Consequen ly, poin s ha a e close o each o he end o be a pa o he
same clus e and poin s ha a e e y a apa end o belong o di e en clus e s. The e a e a ew
di e en me ics ha can be applied o e alua e p oximi y be ween da a poin s, bu he mos common
a e he ollowing ou :
- Single-Linkage: his me ic uses he dis ance be ween he wo closes neighbo s o di e en
clus e s in o de o g oup da a poin s in o new clus e s. I can gene a e clus e s ha a e e y
sp ead-ou and whe e obse a ions in di e en clus e s a e close o each o he han
obse a ions wi hin hei own clus e (Clemen s, 2019).
- Comple e-Linkage: his me ic conside s he dis ance be ween he wo a hes neighbo s o
each clus e o de e mine how clus e s will be g ouped o o m new clus e s. Usually, he inal
clus e s a e e y close o each o he (Clemen s, 2019).
- A e age-Linkage: his me ic uses he a e age dis ance be ween each pai o obse a ions o
e e y combina ion o wo clus e s o de e mine which clus e s a e close o one ano he
(Clemen s, 2019).
- Cen oid-Linkage: his me ic is based on he dis ance be ween he cen oids o wo clus e s
(Clemen s, 2019).
Rega dless o which me ic is used o e alua e p oximi y be ween da a poin s, i is essen ial o de ine
a dis ance me ic o be applied since his is wha will be used o calcula e he p oximi y ma ix and
de ine dis ance be ween obse a ions (LZP, 2019).
14
Also ele an is he ac ha , wi h any o he me ics desc ibed abo e, he implemen a ion o
hie a chical me hods can be e mina ed when a maximum dis ance be ween nea es clus e s exceeds
a p ede ined h eshold (Han, Kambe , & Pei, 2012).
To summa ize, Hie a chical me hods ha e he ad an age o being one o he easies o unde s and in
compa ison o o he me hods. I is also ela i ely simple o implemen and gene a es an appealing
ou pu which is he dend og am. I does no , howe e , usually p o ide he bes solu ions, gi en he
ollowing ac o s (Bock):
- I does no wo k wi h missing da a.
- I does no wo k well wi h ca ego ical alues.
- I does no wo k well wi h la ge olumes o da a. Fo la ge da ase s he cons uc ion o a
dend og am is compu a ionally p ohibi i e (Jain, Mu y, & Flynn, 1999).
2.4.2. Pa i ional Me hods
Pa i ioning echniques o ganize he objec s o a se in o a p ede ined numbe o exclusi e g oups o
clus e s. These clus e s a e o med by op imizing a pa i ioning c i e ion such as a dissimila i y unc ion
based on dis ance, so ha objec s wi hin a clus e a e “simila ” o each o he and “dissimila ” o
objec s o o he clus e s (Han, Kambe , & Pei, 2012).
The mos commonly u ilized pa i ioning me hod is he K-Means algo i hm, which sepa a es he da a
in o clus e s o equal a iances and minimizes a c i e ion known as ine ia o wi hin-clus e sum-o -
squa es, as is ep esen ed by he o mula bellow (sklea n.clus e .Kmeans - sciki -lea n 1.0.1
documen a ion):
0
𝑚𝑖𝑛
∈(||𝑥−𝜇||)
Whe e (𝑥) ep esen s each o he obse a ions in he clus e and (𝜇) ep esen s he mean o he
clus e , which is also known as he cen oid.
As he o mula shows, he objec i e o K-Means algo i hm is o execu e i e a i ely, by di iding he
obse a ions in o clus e s, un il he dis ances o each obse a ion o i s cen oid a e minimal. I can be
in ui i e o conclude ha a big numbe o clus e s would na u ally educe he in a-clus e dis ances.
Howe e , one o he mos impo an aspec s o K-Means is exac ly he de ini ion o he numbe o
clus e s in which he da a will be di ided. The numbe o clus e s should ideally illus a e he g oups
ha ep esen he da a and, since his can be a e y subjec i e ma e , he e a e a ew ools o help
wi h his judgmen .
15
Basically K-Means algo i hm can be implemen ed in he ollowing i e s eps:
1. S ep 1: Choose he numbe o clus e s (K).
2. S ep 2: Selec K andom poin s as cen oids.
3. S ep 3: Assign each obse a ion in he da ase o one o he cen oids, he closes one.
4. S ep 4: Recompu e he cen oids o he newly o med clus e s
5. S ep 5: Repea s eps 3 and 4 un il a s opping c i e ion is achie ed.
The compu a ion o he new cen oids a e each i e a ion is calcula ed as he mean (a e age o all
a ibu es) o all he obse a ions ha belong o each clus e , i.e., all he obse a ions ha a e
associa ed o a cen oid.
Rega ding s ep 5, he e a e basically h ee s opping c i e ia ha can be applied o in e up he
i e a ion (Sha ma, 2019):
- The cen oids o he newly o med clus e s do no change om he p e ious i e a ion.
- All he da a poin s emain in he same clus e s as hey we e in he p e ious i e a ion.
- A maximum p ede ined numbe o i e a ions has been achie ed.
Figu e 2.5, below, shows he basic e olu ion o a K-Means algo i hm execu ion.
Figu e 2. 5: K-Means Algo i hm
(Piech, 2013)
22
would be p ac ically iden ical o he K-Means algo i hm (Bação, Lobo, & Painho, 2005). In his case, i
we conside each uni as a cen oid and i he adius o he neighbo hood unc ion we e equal o ze o,
he cen oid would only be in luenced by he da a poin s ha a e ela ed o i .
2.4.5. Combina ion Me hods
An al e na i e o u ilizing jus one o he clus e ing echniques desc ibed abo e is o implemen a
combina ion o wo o hese me hods. Two combina ions can be pa icula ly use ul: K-Means wi h
Hie a chical and SOM wi h K-Means.
2.4.5.1. K-Means wi h Hie a chical
This is a s a egy ha can be applied in o de o iden i y he app op ia e numbe o clus e s in a da ase
be o e applying K-Means. This is done by i s ly applying a Hie a chical clus e ing algo i hm o de ine
wha would be he ideal numbe o clus e s and hen applying he esul o his as he K in a K-Means
implemen a ion.
Ano he op ion is o do he in e se by, ini ially, implemen ing K-Means wi h a la ge numbe o clus e s
and hen applying a hie a chical me hod in o de o de e mine he app op ia e numbe o clus e s.
2.4.5.2. K-Means wi h SOM
The implemen a ion o SOM is done based on a n-dimensional g id o neu ons which ep esen s he
ou pu space. The p oblem is ha usually his g id is o med by a la ge numbe o neu ons and,
consequen ly, a la ge numbe o clus e s. So, in mos cases, a e applying a SOM algo i hm i is
necessa y o apply ano he clus e ing algo i hm o he esul s o SOM. One o he p e e ed choices
o his is he K-Means algo i hm since i will clus e he g id o neu ons ins ead o he ini ial da a. By
doing his, he algo i hm will y o iden i y clus e s o da a based on he p oximi y o he neu ons,
since du ing he execu ion o he i s algo i hm each o hem will mo e h oughou he ou pu space
acco ding o he numbe o da a poin s ha a e close by.
By using his s a egy, one will be aking ad an age o bo h clus e ing echniques. Fi s , he SOM
algo i hm will make i possible o analyze he dis ibu ion o he da a h ough he ou pu space. And,
la e , K-Means will ansla e his in o a easonable numbe o clus e s ha can be clea ly iden i ied
and ep esen ed.
2.5. PROFILING
One o he las s eps, bu no less impo an , du ing he p ocess o implemen ing clus e ing echniques
is o pe o m clus e p o iling. This is done by analyzing he esul s ha we e achie ed and ying o
make sense o hem. This p ocess usually in ol es he pa icipa ion o business expe s ha a e mo e
accus omed o he nuances o he ield o s udy.
23
The objec i e o clus e p o iling is o e i y i he clus e s ha we e gene a ed by he algo i hm
ansla e in o eal wo ld clus e s o he p oblem a hand and i hey clea ly iden i y and sepa a e he
da a poin s in a way ha makes sense o any u u e analysis and decision making.
2.5.1. Rada Cha
A e y use ul ool o compa e di e en clus e s and p o iles is he ada cha . Wi h his ool i is
possible o compa e he beha io o nume ical a iables amongs di e en obse a ions. Since clus e s
can be ep esen ed by a cen oid o an a e age alue, ada cha s can be applied o compa e hese
alues o pe o m g aphical analysis o hei cha ac e is ics.
Rada cha s a e buil by a ibu ing each a iable o an indi idual axis, which a e spaced equally, and
a anging hem a ound he cen e . Each obse a ion is hen plo ed along each axis like a sca e plo
and he poin s a e connec ed o o m a polygon (Radečić, 2021). A e wa ds, each obse a ion can be
plo ed in o he same plo . Al e na i ely, indi idual plo s can be gene a ed o each obse a ion.
Figu e 2.11 below shows an example o a ada cha ha was buil o compa e a iables o h ee
di e en obse a ions.
Figu e 2. 11: Example o a Rada Cha
(Radečić, 2021)
This example compa es 5 a iables ega ding he quali ies o h ee es au an s. The ada cha helps
in iden i ying he s eng hs o each one o hese es au an s. One pe o ms be e in e ms o
a o dabili y while ano he pe o ms be e in e ms o ood a ie y, quali y, and ambience. Howe e ,
he impo an aspec o his analysis is ha i could be applied o a g oup o obse a ions (clus e s)
such as di e en es au an chains.
24
3. CLUSTER ANALYSIS
In his sec ion he gambling da a ega ding use beha io on online pla o ms in Po ugal will be
analyzed. Ini ially, he da a om 2019 will be examined in o de o iden i y use clus e s. A e wa ds,
he da a om 2020 will also be analyzed and he esul s will be compa ed o hose o 2019. All he
da a analysis will be pe o med in Py hon h ough he use o Jupy e No ebooks and du ing he
p esen a ion o he esul s some o hese s eps will be shown.
Fi s i is impo an o highligh ha a decision was made in e ms o he scope o his wo k. The
pla o ms ha ha e au ho iza ion o p omo e online gambling in Po ugal o e wo ypes o ac i i ies:
spo s be s and games o chance. In 2019 spo s be s gene a ed a g oss income close o 107 million
eu os and games o chance gene a ed a g oss income close o 109 million eu os, indica ing bo h had
almos equal ele ance in he business. In e ms o be ing olumes spo s be s o aled some hing
a ound 543 million eu os while games o chance eached alues o 2,9 billion eu os (Tu ismo de
Po ugal, 2019). Wi h ha in mind, and conside ing ha spo s be s p obably su e ed impac s in 2020
caused by he Co id-19 pandemic ha would complica e any compa ison wi h da a om 2019, a
decision was made o limi he scope o his wo k o da a ega ding games o chance.
Rega ding he scope o games o chance, he ollowing ou games we e made a ailable o playing
du ing he ou h imes e o 2019: slo machines, oule e, blackjack, and poke ( wo ypes). The
dis ibu ion o he be ing olumes be ween hese games is shown in Figu e 3.1 below.
Figu e 3. 1: Dis ibu ion o Be ing Volume in 2019
(Tu ismo de Po ugal, 2019)
25
As he image shows, slo machines ep esen ed almos 69% o be ing olumes in he ou h imes e
o 2019. Since his indica es ha slo machines a e e y signi ican o his business and ha i is a o m
o game ha a ac s in ense le el o gaming, i has been chosen o he analysis ha has been
p oposed in his wo k. Consequen ly, he scope o he wo k will be limi ed o he da a ega ding use
ac i i y while playing online slo machines.
3.1. CLUSTER ANALYSIS FOR 2019 DATA
The i s po ion o his wo k will be dedica ed o he e alua ion o da a om 2019.
3.1.1. 2019 Da a Loading and Ini ial Analysis
The o iginal and aw da a ega ding use ac i i y wi hin he en en i ies ha had pe mission o p o ide
online gambling in 2019 we e deli e ed o NOVA IMS by SRIJ. The aw da a con ains speci ic de ails o
each ansac ion execu ed in he pla o ms h oughou he yea .
This da a was consolida ed by he s a o NOVA IMS in o he o m o daily eco ds, which will be he
s a ing poin o all analysis pe o med in his wo k. The consolida ed ile was deli e ed in he o m o
a CSV ile wi h 3.512.157 en ies and wi h no missing alues.
The ile con ains he ollowing a iables:
Table 3. 1: Lis o Va iables in 2019 CSV File
Va iable Desc ip ion
ope a ion Va iable c ea ed du ing he consolida ion o he da a
en i y_id Id o he En i y (1,2,3,4,5,6,7,9,10,11)
playe _id Id o he Playe in ha En i y
day_d Da e in he o ma 'YYYYMMDD'
day_num Day o Mon h
day_o _week Day o Week (0,1,2,3,4,5,6)
amoun To al Amoun played du ing he day
amoun _ a Va ia ion o he Amoun du ing he day
amoun _s d S anda d De ia ion o he Amoun du ing he day
hou s_played Hou s played du ing he day
coun Numbe o be s placed du ing he day
wins Numbe o wins du ing he day
balance Finan ial Balance a he end o he day
dawn Numbe o be s placed du ing he dawn pe iod (00:00 o 5:59)
mo ning Numbe o be s placed du ing he mo ning pe iod (06:00 o 11:59)
a e noon Numbe o be s placed du ing he a e noon pe iod (12:00 o 17:59)
nigh Numbe o be s placed du ing he nigh pe iod (18:00 o 23:59)
amoun _mean A a age Amoun o each be
wins_pe c Pe cen age o wins du ing he day
dawn_pe c Pe cen age o be s placed du ing dawn
mo ning_pe c Pe cen age o be s placed du ing he mo ning
a e noon_pe c Pe cen age o be s placed du ing he a e noon
nigh _pe c Pe cen age o be s placed du ing he nigh
balance_pe c Ra io o balance and amoun
playe _uid Unique Use Id
sel _excluded Indica ion i he use has e e been sel excluded
26
In summa y, each eco d con ains he desc ip ion o use ac i i y du ing a speci ic day in which ha
playe was ac i e in one o he en online pla o ms.
To be e unde s and his in o ma ion a ew o he a iables lis ed on Table 3.1 mus be be e
explained:
- PLAYER_ID: his a iable e e s o he iden i ica ion o a use in a speci ic pla o m. This means
ha he same pe son can be egis e ed in wo o mo e pla o ms and will consequen ly ha e
a di e en PLAYER_ID in each one o hem
- PLAYER_UID: his e e s o a unique use iden i ica ion and indica es ha a pe son will ha e
he same ID h oughou all he eco ds in he da ase .
- WINS: since he concep o ic o y in gambling can be conside ed subjec i e, o his s udy only
si ua ions in which he playe inishes he be wi h mo e money han wha was in es ed
ini ially will be conside ed a win. So, o ins ance, i a playe in es s 10 eu os in a be and ends
up wi h 8 eu os ha will no be conside ed a win, since he playe ’s balance will be o minus 2
eu os.
- SELF_EXCLUDED: all online pla o ms mus p o ide an al e na i e o use s ha eel hey do
no ha e a heal hy gambling beha io o exclude hemsel es om he pla o ms. This bina y
a iable indica es i he use has, a any ime, been sel -excluded in ha speci ic pla o m. I is
impo an o men ion ha his a iable is jus an indica ion i he playe has e e been sel -
excluded wi h no indica ion o he pe iod in which his happened.
An impo an aspec o conside in his ini ial analysis o he aw da a is ha he eco ds a e no e enly
dis ibu ed among he 10 pla o ms. Table 3.2 below shows he numbe o eco ds o each en i y and,
also, he pe cen age o eco ds o each en i y in ela ion o he o al numbe o eco ds o he da ase
(3.512.157 en ies).
Table 3. 2: Numbe o eco ds o each En i y
En i i y ID Numbe o Reco ds Pe cen age
1 635.367,00 18,1%
2 479.268,00 13,6%
3 872.422,00 24,8%
4 624.067,00 17,8%
5 184.364,00 5,2%
6 327.880,00 9,3%
7 115.731,00 3,3%
9 15.626,00 0,4%
10 121.856,00 3,5%
11 135.576,00 3,9%
To al 3.512.157,00 100%
27
The in o ma ion in he able shows ha while some en i ies ha e a e y signi ican pa icipa ion in
online slo machine gambling o he s ha e e y li le ep esen a ion. This could be caused by he ac
ha some en i ies a e newe o he business and ha e no ye achie ed a ele an use base. This also
indica es ha he esul s achie ed du ing his wo k could ha e a ia ions based on he business
s a egies implemen ed by each en i y since some o hem migh be willing o accep smalle p o i s
han o he s.
Ano he ele an ma e ha can be analyzed in he aw da a is he a ia ion o he a ibu es du ing
he yea since some speci ic use beha io s can be in luenced by seasonali y. Figu e 3.2 below shows
he g aphic ep esen a ions o he a ia ion o ou majo a ibu es in his da ase based on he
a e age alues o each mon h.
Figu e 3. 2: Va ia ion o a ibu es du ing 2019
This image demons a es ha he numbe o be s and he o al numbe o hou s played du ing he day
did no change e y much du ing he yea . I is no iceable, howe e , ha he amoun a ia ion and
balance inc eased owa ds he end o he yea . Gi en ha he inc ease is ela i ely signi ican o bo h
a iables i is concei able ha his is caused by ou lie s.
The inc ease in balance is especially in iguing since i has a nega i e alue h oughou he yea and
jumps o a posi i e alue in he mon h o Decembe . Buy looking a he a e age alues o each mon h
i becomes clea ha in ac he alues ha ep esen he balance a e unexpec ed. Be ween he
mon hs o Janua y and No embe he highes alue o balance was -4,69 and he lowes alue was -
9,90. In Decembe he a e age balance becomes 6,63 and his would indica e ha on a e age he
playe s would ha e had a p o i o e he online pla o ms du ing his mon h. Since his wouldn’ be
easonable om a business s andpoin i e y likely ha hese numbe s a e being in la ed due o
28
ou lie s and ha some so o ea men will be necessa y o a oid ha hese ou lie s pollu e he
models ha will be c ea ed.
Ou lie s can ep esen ac ual alues ha indica e ex eme alues can occu in he da ase . They can
also, howe e , be gene a ed by da a en y e o s and in e ace p oblems while da a is being
ans e ed om one sys em o ano he . In he case o he a iable BALANCE he e a e eco ds ha
indica e daily balances o o e 200.000 eu os, which seems ex emely un easonable. So, as a way o
analyzing he e ec s o ex eme alues in his da ase , he mon hly a e age o he a iable BALANCE
will be calcula ed, i s ly wi h all he eco ds and secondly wi h a limi a ion o he alues, conside ing
he numbe ha ep esen s he 0,99 pe cen ile, i.e., all alues ha a e highe han he 0,99 pe cen ile
will be changed o his maximum alue. Tables 3.3 and 3.4 show he esul s o his compa ison.
Table 3. 3: A e age Balance wi h Ou lie s
Table 3. 4: A e age Balance wi hou ou lie s
Mon h A e age Balance (€)
Janua y -7,99
Feb ua y -4,69
Ma ch -5,46
Ap il -5,58
May -7,72
June -9,90
July -8,49
Augus -5,66
Sep embe -6,71
Oc obe -6,18
No embe -7,99
Decembe 6,63
Mon h A e age Balance (€)
Janua y -23,92
Feb ua y -26,39
Ma ch -25,76
Ap il -27,00
May -29,58
June -29,42
July -27,58
Augus -25,28
Sep embe -26,54
Oc obe -26,93
No embe -25,23
Decembe -20,86
29
Fi s , i is no iceable how hese ou lie s a ec he a e age mon hly alues. Bu mo e impo an ly is he
ac ha speci ically o he mon h o Decembe he ou lie s caused he a e age alue o be o ally
incohe en wi h wha had happened in p e ious mon hs and e en wi h wha would be expec ed as a
no mal balance alue om a business poin o iew.
3.1.2. 2019 Da a P epa a ion
As i has been demons a ed p e iously, i is impo an o pe o m some le el o p epa a ion o he
da ase . This in ol es hings like ea u e enginee ing, a iable selec ion, exclusion o ou lie s, among
o he s, and will be add essed in he ollowing sec ions.
3.1.2.1. Fea u e Enginee ing
One aspec o his da ase ha s ands ou is he ac ha i does no con ain many ca ego ical a iables
ha would help desc ibe he use s such as age, gende , and loca ion. The only ca ego ical a iables
ha a e p esen in he da ase a e ENTITY_ID and SELF_EXCLUDED which indica e he pla o m en i y
iden i ica ion and i he playe has e e been sel -excluded om ha pla o m espec i ely.
Gi en his ac and conside ing ha ea u e enginee ing can gene a e impo an in o ma ion o
machine lea ning models, a ew a ibu es we e c ea ed o enhance hese models. Table 3.5 below
shows a lis and desc ip ion o hese new ea u es.
Table 3. 5: New Fea u es
Va iable Desc ip ion
day_ ype
Ca ego ical a iable o de e mine i he day ela ed o he eco d e e s o a weekday o
a weekend. Fo his pu pose, Monday, Tuesday, Wednesday and Thu sday will be
conside ed weekdays and F iday, Sa u day and Sunday will be conside ed weekends.
Weekdays will ha e alue 0 and weekends will ha e alue 1.
use _id An iden i ica ion o he playe in each en i y. This a ibu e will be a conca ena ion o he
en i y_id and playe _id a iables.
a g_play_pe _hou
This will be a calcula ed a ibu e ha will show how many be s he use made on
a e age each hou o he day. I will be calcula ed by di iding he hou s_played a iable
by he coun a iable.
au oma ed_play
Bina y ca ego ical a iable o de e mine i he playe used any o m o au oma ed ool o
play du ing he day. Whene e he a g_play_pe _hou is g ea e han 360 his will be
conside ed ue and ecei e alue 1. O he wise, i will ha e alue 0.
winning_day Ca ego ical a iable ha indica es i he playe had a "winning" day. This a ibu e will
ecei e alue 1 i he playe balance is posi i e and will ecei e 0 o he wise.
30
3.1.2.2. Da a Agg ega ion
Ano he ele an aspec o his da ase is ha he da a is g ouped in he o m o daily eco ds. This
means ha he in o ma ion ega ding use ac i i y is o ganized in a way ha shows he o ali y o he
in e ac ions he use had in each day o he yea . As a esul , each use will ha e as many eco ds in
he da ase as he numbe o days in which he o she was ac i e in online gambling pla o ms. Fo
ins ance, i a playe was ac i e on 10 di e en days o he yea , ha playe will ha e 10 eco ds in he
da ase .
Since he objec i e o his wo k is o unde s and playe beha io and o analyze how he a e age
beha io migh ha e changed om 2019 o 2020, a decision was made o g oup he da a conside ing
use iden i ica ions. In his manne a da ase will be gene a ed in which each eco d will show he
“a e age” beha io o one speci ic use du ing he yea o 2019.
Fo he pu poses o agg ega ion, he a iable USER_ID ha ep esen s he iden i ica ion o use s in
each en i y has been chosen ins ead o he a iable PLAYER_UID ha ep esen s a unique iden i ica ion
o use s ac oss all pla o ms. This is due o he ac ha he PLAYER_UID a ibu e is no conside ed
comple ely eliable and could gene a e inconsis encies in he esul o he agg ega ion.
The able below shows he lis o he a ibu es o he da ase ha we e gene a ed o agg ega e da a
o use s in o indi idual eco ds.
Table 3. 6: A ibu es o agg ega ed da ase
Va iable Desc ip ion
use _id (index) Use Id ha combines o iginal Id and En i y Numbe
days_played Numbe o days o he yea in which he use played slo machine
a g_coun How many ime he use played on a e age each day
a g_win_pe c How many wins he playe had on a e age each day
a g_amoun The inan ial amoun he playe be on a e age each day
a g_amoun _mean The a e age o he mean amoun pe be
a g_amoun _ a The a e age o he amoun a ia ion
a g_amoun _s d The a e age o he amoun s anda d de ia ion
a g_balance The a e age o use balance pe day
a g_au o_play The pe cen age o days in which he playe used au o play mecanism
a g_day_ ype The pecen age o days ha we e weekends (F iday-Sunday)
a g_hou s_played How many hou s he use played on a e age pe day
a g_dawn_pe c A e age pe cen age o dawn play
a g_mo ning_pe c A e age pe cen age o mo ning play
a g_a e noon_pe c A e age pe cen age o a e noon play
a g_nigh _pe c A e age pe cen age o nigh play
sel _excluded Indica es i playe was e e sel exluded
en i y_id En i y Id
winning_day_a g Pe cen age o days in which he playe had a winning day
31
The decision o agg ega e he da ase based on he use s may cause he loss o speci ic daily
in o ma ion which will ha e o be analyzed as an a e age h oughou he yea . I will, on he o he
hand, allow o a be e unde s anding o gene al cha ac e is ics o each use . And by doing his i will
be possible o sepa a e hese use s in clus e s based on hei beha io du ing he yea .
The da ase ha was gene a ed wi h in o ma ion agg ega ed by use s has 253.826 eco ds, meaning
his is he numbe o use s ha played online slo machine a leas once in 2019.
3.1.2.3. Scope Limi a ion
Following his decision o g oup he da ase in o eco ds ha iden i y each use , comes he decision o
which eco ds should be conside ed o his analysis. Since he idea is o unde s and he ypical use
beha io and la e o compa e his wi h da a om 2020 o iden i y any beha io shi s, i would no
make sense o keep in he da ase eco ds ela ed o use s ha ha e had limi ed amoun o in e ac ion
wi h he online gambling pla o ms. Table 3.7 below shows he dis ibu ion o use s acco ding o he
equency in which hey played. In his case he equency is calcula ed based on he numbe o days
o he yea in which he playe placed a leas one be .
Table 3. 7: Dis ibu ion o use s acco ding o equency o play
As Table 3.7 shows, 67% o use s we e only ac i e in online gambling in i e days o less du ing 2019.
Fo he pu poses o unde s anding use p o iles and iden i ying speci ic use beha io s hese use s can
be conside ed i ele an and could ac ually ha m he analysis. In a mo e di ec conclusion, and o he
objec i es o his wo k, hese use s can be classi ied as “non-playe s”.
Wi h his e alua ion i was decided o exclude hese use s om he da ase and o p oceed in he
analysis only wi h use s ha we e ac i e in a leas 6 days o he yea . This ep esen s a ound 33% o
he da a and educes he da ase o 92.021 eco ds.
Days Played Pe cen age
(0,1] 37%
(1,5] 30%
(5,10] 10%
(10,50] 16%
(50,100] 4%
(100,300] 3%
(300,365] 0%
38
The in a-clus e dis ances (ine ia) o his model a e sligh ly be e han o he p e ious model and
he elbow g aph sugges s he model should ha e six clus e s. Table 3.10 shows he cen oids o his
model.
Table 3. 10: Cen oids o Model 2
This model also does no gene a e in e p e able clus e s. Some a iables seem i ele an in e ms o
clus e di e en ia ion. Clus e dis ibu ion also was no ideal wi h clus e 1 ha ing only 3 eco ds.
3.1.3.3. Model 3
This model will be implemen ed wi h he ollowing con igu a ion:
- Algo i hm: K-Means
- Va iables: Excluding ENTITY_ID and SELF_EXCLUDED; keeping only one AMOUNT a iable;
keeping wo FREQUENCY a iables; keeping one WINNING a iable; excluding all PERIOD OF
DAY a iables
- Scale : S anda d Scale
- Ou lie s: Ou lie s will no be al e ed
Clus e AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_HOURS_PLAYED AVG_AUTO_PLAY AVG_DAY_TYPE
0 0.17 1.81 -10.09 2.47 0.02 0.40
1 0.32 7142.50 15401.52 5.25 0.35 0.44
2 0.30 3.07 43.44 2.78 0.04 0.42
3 0.16 1.28 -9.14 2.20 0.03 0.44
4 0.16 2.89 -10.63 2.25 0.04 0.42
5 0.19 3.00 -21.14 4.76 0.32 0.43
Clus e WINNING_DAY_AVG AVG_DAWN_PERC AVG_MORNING_PERC AVG_AFTERNOON_PERC AVG_NIGHT_PERC WINNING_DAY_AVG
0 0.19 0.10 0.26 0.48 0.23 0.19
1 0.32 0.27 0.14 0.35 0.32 0.32
2 0.49 0.18 0.15 0.35 0.36 0.49
3 0.19 0.15 0.08 0.25 0.54 0.19
4 0.20 0.50 0.08 0.18 0.26 0.20
5 0.29 0.25 0.13 0.28 0.36 0.29
39
The elbow g aph o his model is shown on Figu e 3.8.
Figu e 3. 8: Elbow G aph o Model 3
The in a-clus e dis ances seem o ha e imp o ed in his model and he g aph sugges s i e clus e s.
Which a e ep esen ed by i s cen oids on Table 3.11 below.
Table 3. 11: Cen oids o Model 3
Model 3 is he bes model un il now, since i seems o gene a e easonably in e p e able clus e s, e en
hough some a iables emain i ele an o he model such as AVG_WIN_PERC and AVG_DAY_TYPE.
Addi ionally, clus e 3 con ains only h ee eco ds, p obably due o ou lie s.
3.1.3.4. Model 4
This model will be implemen ed wi h he ollowing con igu a ion:
- Algo i hm: K-Means
- Va iables: Excluding ENTITY_ID and SELF_EXCLUDED; keeping only one AMOUNT a iable;
keeping wo FREQUENCY a iables; keeping one WINNING a iable; excluding all PERIOD OF
DAY a iables
- Scale : No maliza ion (Minmax)
- Ou lie s: Ou lie s will no be al e ed
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_DAY_TYPE
0 17.83 2.58 0.35 4.49 53.33 0.40
1 19.94 2.20 0.17 1.01 -7.29 0.57
2 110.18 4.40 0.18 3.81 -13.33 0.42
3 15.00 5.25 0.32 7142.50 15401.52 0.44
4 21.00 2.21 0.16 1.71 -10.88 0.32
40
The Elbow G aph o his model is shown on Figu e 3.9.
Figu e 3. 9: Elbow G aph o Model 4
The elbow g aph sugges s ou clus e s, which a e ep esen ed by i s cen oids on Table 3.12.
Table 3. 12: Cen oids o Model 4
This model gene a es clea ly iden i iable clus e s. Clus e 3, o example, ep esen s high in ensi y
gambling wi h g ea e losses. Clus e s 1 and 2 ep esen use s ha make p o i s bu ha e speci ic
gambling habi s.
3.1.3.5. Model 5
This model will be implemen ed wi h he ollowing con igu a ion:
- Algo i hm: K-Means
- Va iables: Excluding ENTITY_ID and SELF_EXCLUDED; keeping only one AMOUNT a iable;
keeping wo FREQUENCY a iables; keeping one WINNING a iable; excluding all PERIOD OF
DAY a iables
- Scale : S anda d Scale
- Ou lie s: Ou lie s will be limi ed o he 99 h Pe cen ile
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_DAY_TYPE
0 29.61 2.76 0.19 2.07 -2.62 0.43
1 13.75 2.17 0.20 3.64 0.62 0.23
2 13.60 2.21 0.19 1.34 0.64 0.64
3 166.23 3.78 0.18 3.35 -9.83 0.42
41
The elbow g aph o his model is show on Figu e 3.10.
Figu e 3. 10: Elbow G aph o Model 5
The elbow g aph indica es ha he ideal numbe o clus e s is se en. Since his seems exagge a ed
o he p oblem a hand he model will be implemen ed wi h six clus e s. They a e ep esen ed by
he cen oids in Table 3.13.
Table 3. 13: Cen oids o Model 5
This model minimizes he nega i e e ec s ha ou lie s had caused in p e ious models ha used
S anda d Scale . Clus e s can be isualized mainly due o he FREQUENCY a iables and he mone a y
alues (AMOUNT and BALANCE). The clus e s a e well dis ibu ed and clus e s numbe s 1 and, 2 ha
ep esen in ensi e gamble s (possibly addic i e beha io ), ep esen a ound 22% o use s.
3.1.3.6. Model 6
This model will be implemen ed wi h he ollowing con igu a ion:
- Algo i hm: K-Means
- Va iables: Excluding ENTITY_ID and SELF_EXCLUDED; keeping only one AMOUNT a iable;
keeping wo FREQUENCY a iables; keeping one WINNING a iable; excluding all PERIOD OF
DAY a iables
- Scale : No maliza ion (Minmax)
- Ou lie s: Ou lie s will be limi ed o he 99 h Pe cen ile
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_DAY_TYPE
0 17.67 2.44 0.36 0.34 37.49 0.40
1 169.61 3.64 0.17 0.42 -7.47 0.42
2 46.46 3.19 0.20 18.35 -154.28 0.40
3 19.54 2.04 0.17 0.20 -5.68 0.58
4 35.07 4.76 0.18 0.36 -11.54 0.42
5 22.20 2.03 0.16 0.24 -7.53 0.32
42
The elbow g aph o his model is show on Figu e 3.11.
Figu e 3. 11: Elbow G aph o Model 6
The elbow g aph indica es ha he ideal numbe o clus e s could be ei he ou o i e. Since in he
p e ious model six clus e s we e u ilized, his model will also be es ed wi h six clus e s. The clus e s
o each o hese h ee op ions a e ep esen ed in he ollowing ables:
Table 3. 14: Cen oids o Model 6 wi h 4 Clus e s
Table 3. 15: Cen oids o Model 6 wi h 5 Clus e s
Table 3. 16: Cen oids o Model 6 wi h 6 Clus e s
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_DAY_TYPE
0 21.38 2.49 0.19 0.27 -2.73 0.32
1 20.30 2.44 0.19 0.23 -2.13 0.56
2 47.01 3.16 0.20 18.41 -125.68 0.40
3 151.51 3.73 0.17 0.40 -8.08 0.42
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_DAY_TYPE
0 13.66 2.17 0.20 0.25 -1.95 0.23
1 29.51 2.74 0.19 0.27 -3.44 0.43
2 46.97 3.16 0.20 18.43 -125.96 0.40
3 166.30 3.78 0.18 0.41 -7.90 0.42
4 13.58 2.20 0.19 0.21 -1.15 0.64
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_DAY_TYPE
0 31.26 2.75 0.17 0.27 -7.54 0.43
1 13.56 2.15 0.17 0.24 -6.70 0.23
2 47.08 3.17 0.20 18.46 -126.69 0.40
3 168.32 3.80 0.18 0.42 -7.87 0.42
4 17.01 2.58 0.37 0.30 33.25 0.39
5 13.55 2.18 0.18 0.21 -3.54 0.65
43
All h ee al e na i es gene a e easonable clus e s ha can be clea ly de ined. The al e na i e wi h 6
clus e s, howe e , seems o gene a e a mo e in e es ing di ision since clus e ou ep esen s playe s
ha ha e a winning pa e n o gambling. One hing ha s ands ou is ha he a iables
AVG_WIN_PERC and AVG_DAY_TYPE do no seem ele an o sepa a e use s. In he case o he
a iable AVG_DAY_TYPE, i only se es o sepa a e clus e s 1 and 5 indica ing ha playe s on clus e 5
ha e a endency o play mo e equen ly on weekends. This, howe e , does no seem o imp o e use
segmen a ion.
3.1.3.7. Model 7
This model will be implemen ed wi h he ollowing con igu a ion:
- Algo i hm: K-Means
- Va iables: Excluding ENTITY_ID, SELF_EXCLUDED and AVG_DAY_TYPE; keeping only one
AMOUNT a iable; keeping wo FREQUENCY a iables; keeping one WINNING a iable;
excluding all PERIOD OF DAY a iables
- Scale : No maliza ion (Minmax)
- Ou lie s: Ou lie s will be limi ed o he 99 h Pe cen ile
The elbow g aph o his model is show on Figu e 3.12.
Figu e 3. 12: Elbow G aph o Model 7
The elbow g aph indica es ha he numbe o clus e s could be be ween 3 and 6, so he model will be
implemen ed wi h 5 clus e s o e alua e i he e can be any educ ion in compa ison o he las model.
The cen oids o hese i e clus e s a e ep esen ed in he ollowing able.
44
Table 3. 17: Cen oids o Model 7
This model also gene a ed easonable clus e s ha can be clea ly iden i ied and ha a e easonably
dis ibu ed.
3.1.3.8. Model 8
This model will be implemen ed wi h he ollowing con igu a ion:
- Algo i hm: SOM
- Va iables: Excluding ENTITY_ID, SELF_EXCLUDED and AVG_DAY_TYPE; keeping only one
AMOUNT a iable; keeping wo FREQUENCY a iables; keeping one WINNING a iable;
excluding all PERIOD OF DAY a iables
- Scale : No maliza ion (Minmax)
- Ou lie s: Ou lie s will be limi ed o he 99 h Pe cen ile
The implemen a ion o SOM will be expe imen ed in a 10x10 ea u e map ha will be execu ed o
100 epochs. A e wa ds, K-Means will be applied o he esul s o SOM in o de o ob ain six clus e s
o da a.
The BMU Hi s View displayed on Figu e 3.13 below indica es he numbe o eco ds associa ed o each
neu on (uni ) in he ea u e map.
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE
0 15.05 2.47 0.34 0.28 26.94
1 56.30 3.86 0.18 0.37 -9.21
2 15.28 2.02 0.16 0.20 -7.55
3 191.86 3.87 0.17 0.44 -8.24
4 46.50 3.15 0.20 18.33 -125.04
45
Figu e 3. 13: BMU Hi s View o Model 8
And a e applying K-Means he Hi s Map on Figu e 3.14 indica es which neu ons a e associa ed o
each clus e .
Figu e 3. 14: Hi s Maps o Model 8
46
The hi s map gi es an idea o he dis ibu ion o he eco ds be ween he clus e s wi h Clus e 0 ha ing
he g ea e numbe o eco ds and Clus e 5 being he smalles clus e .
By calcula ing he a e age alues o he a iables in each clus e i is possible o iden i y alues ha
can be conside ed as he cen oids o each clus e . These cen oids a e ep esen ed in he ollowing
able.
Table 3. 18: Cen oids o Model 8
The cen oids o his model a e e y simila o hose o model 6 ha used K-Means and i also
gene a es easonable clus e s ha a e well dis ibu ed.
3.1.4. Model Selec ion o 2019 Da a
A e ha ing implemen ed a se ies o di e en models, one o hem mus be chosen as he p ima y
model o modeling his da a. One way o e alua ing all hese models is o check hei silhoue e sco es.
The ollowing able shows he alue o each model.
Table 3. 19: Silhoue e Sco es o he Models
One hing ha is clea , by looking a hese sco es, is ha models in which ou lie s we e ea ed had a
much be e pe o mance. This is he case o models 5 h ough 8.
Clus e DAYS_PLAYED AVG_HOURS_PLAYED AVG_WIN_PERC AVG_AMOUNT_VAR AVG_BALANCE AVG_DAY_TYPE
0 29.19 2.80 0.16 0.14 -4.25 0.42
1 124.41 4.35 0.18 0.34 -9.62 0.42
2 15.34 1.94 0,16 0.14 -5.44 0.60
3 13.61 1.95 0.16 0.18 -9.26 0.24
4 18.71 2.36 0.33 0.25 30.29 0.40
5 40.70 3.05 0.19 12.28 -125.96 0.40
Model Silhou e Sco e
Model 1 0.11
Model 2 0.13
Model 3 0.02
Model 4 0.01
Model 5 0.24
Model 6 (4 clus e s) 0.30
Model 6 (5 clus e s) 0.27
Model 6 (6 clus e s) 0.28
Model 7 0.38
Model 8 0.23
47
I is clea ha Model 7 had he bes pe o mance, ollowed by Model 6. And Model 8, which
implemen ed SOM, did no pe o m e y well in compa ison o hese o he models.
Ano he o m o e alua ing he quali y o he models is o plo hei silhoue e coe icien s. Since,
based on he silhoue e a e age sco e, i is al eady possible o ha e an idea o his quali y, only he
coe icien s o models 6 (wi h 6 clus e s) and 7 will be plo ed. These we e wo o he models wi h
bes silhoue e a e age sco es.
Figu e 3.15 displays he silhoue e plo o Model 6 (wi h 6 clus e s).
Figu e 3. 15: Silhoue e Plo o Model 6 (wi h 6 clus e s)
The plo shows ha clus e s 0, 2, 3, 4 and 5 ha e some silhoue e coe icien s below 0 which indica es
ha some eco ds migh ha e been inco ec ly classi ied. The hickness o hese lines, howe e ,
indica e ha his did no happen o many eco ds. The hickness o he lines also helps in iden i ying
ha clus e 0 is he la ges clus e and clus e 2 is he smalles clus e . And i is also pe cep ible ha
clus e s 1, 2, 3 and 5 ha e mos eco ds wi h silhoue e coe icien s abo e he a e age o 0,28.
54
As a esul o he analysis o each o he clus e s, he p o iles lis ed on Table 3.27 we e iden i ied.
Table 3. 27: Lis o P o iles (2020)
As i was done wi h he da a om 2019, he p o iles we e de ined based on he endency o ha e
compulsi e gambling beha io . In he case o he da a om 2020, clus e s 2 and 3 a e he ones ha
ep esen playe s wi h high p obabili y o ha ing addic i e gambling habi s. Clus e 2 ep esen s
playe s ha play wi h a high equency and clus e 3 ep esen s playe s ha lose la ge mone a y
alues. These playe s wi h high compulsi e beha io ep esen 12% o he use s in he da ase .
As i was no ed wi h he da a om 2019, he e a e di e ences in use beha io based on he en i y in
which hey played. The able below shows he pe cen age o use s o each en i y associa ed o each
clus e .
Table 3. 28: P opo ional Dis ibu ion o Clus e s by En i y (2020)
Clus e Clus e Name Desc ip ion Compulsi e Beha io P opo ion o Clus e
0 F equen Small Lose Plays wice a week. Loses small amoun s o money and he
amoun s do no a y much du ing he day. Medium 23%
1 Spo adic Playe
Plays once a week and o ew hou s each day. Loses small
amoun s o money and he alues o he be s do no a y
much du ing he day.
Low 58%
2 F equen Playe
Plays wi h a high equency and o many hou s each day.
Does no lose much money and he alues o he be s do no
a y much du ing he day.
High 10%
3 High Value Playe Plays wice a week. Loses a high amoun o money and he
be ing alues a y a lo du ing he day. High 2%
4 Winning Playe Plays once a week and has a high pe cen age o wins. This
leads o posi i e balances o he playe . Low 7%
En i y/Clus e 0 1 2 3 4
1 23,79% 61,26% 12,75% 1,86% 0,35%
2 21,00% 41,37% 9,02% 1,22% 27,39%
3 25,76% 59,21% 10,49% 2,33% 2,21%
4 22,99% 65,89% 9,97% 0,95% 0,20%
5 24,57% 58,15% 11,30% 2,85% 3,11%
6 26,86% 56,38% 11,54% 2,89% 2,33%
7 17,13% 31,71% 5,91% 0,89% 44,36%
9 13,95% 59,69% 3,57% 3,06% 19,73%
10 16,32% 77,96% 4,16% 1,48% 0,08%
11 23,72% 54,70% 11,78% 1,48% 8,32%
To al 23,11% 58,45% 10,15% 1,69% 6,60%
55
The analysis makes i clea ha he e a e simila i ies in he clus e s ha we e gene a ed by he model
o he da a o each yea . The e a e also, howe e , some di e ences in a ew cha ac e is ics o hese
clus e s and in he p opo ion each one o hem ep esen s. These aspec s will be analyzed in he
Resul s sec ion o his wo k.
3.3. CLUSTER SHIFTS BETWEEN 2019 AND 2020
An impo an analysis ha can be made is o e i y in o which clus e s o 2019 he da a om 2020
would i in o. By doing his i is possible o e i y i use s ha e mo ed om one clus e o ano he
du ing he lockdown pe iod o he pandemic. And, in doing so, i is possible o quan i y he numbe o
use s ha ha e de eloped compulsi e gambling beha io s and hose ha ha e ei he main ained
p e ious beha io s o de eloped heal hie ones.
The e a e many echniques a ailable o classi y da apoin s in o p e iously gene a ed clus e s. Fo his
wo k, a supe ised lea ning me hod called KNeighbo sClassi ie will be u ilized. In his me hod each
da apoin ha needs o be classi ied is compa ed in e ms o dis ance (Euclidean dis ance in his case)
o all he da apoin s in he o iginal da ase and he K nea es neighbo s a e selec ed. A e wa ds, by a
o m o o e he new da apoin is classi ied based on he classi ica ion o he majo i y o i s K nea es
neighbo s (sklea n.neighbo s.KNeighbo sClassi ie -sciki -lea n 1.0.1 documen a ion).
So, in he case o classi ying he da a om 2020 in o he 2019 clus e s, KNeighbo sClassi ie will be
implemen ed wi h a K o 3. Each da apoin (use ) om he 2020 da ase will be compa ed o he
da apoin s om he 2019 da ase and he h ee closes neighbo s will be iden i ied. This da apoin will
hen be classi ied acco ding o he classi ica ion o he majo i y o hese 3 neighbo s. So, o example,
i wo neighbo s a e associa ed o clus e 1 and one neighbo is associa ed o clus e 2, he 2020
da apoin will be associa ed o clus e 1.
A e doing his, i will be possible o compa e each use based on i s o iginal clus e in 2019 and on
he clus e i would be associa ed o based on i s a iables in 2020.
And so, he ollowing able shows he clus e shi s o he 31.615 use s ha we e p esen in bo h 2019
and 2020 da ase s. I summa izes he numbe o use s in each o he possible clus e combina ions in
he yea s 2019 and 2020.
Table 3. 29: Clus e Shi s
0 1 2 3 4
0 882 996 638 511 57
1 726 4.444 1.924 3.529 200
2 1.054 4.145 4.975 2.090 173
3 114 1.122 253 3.085 85
4 31 132 74 89 286
2019
2020
Clus e Shi s
56
This analysis only con empla es he use s ha we e p esen in bo h he 2019 and 2020 da ase s, which
is a o al o 31.615 use s, since i would no make sense o include use s ha we e only ac i e in one
o he yea s in o de o iden i y clus e shi s. And by analyzing his able, a ew insigh s can be eached:
- 13.672 (43%) o use s did no change o a di e en clus e in 2020.
- 6.560 (21%) o use s mo ed om clus e s o low (clus e s 0 and 2) o medium (clus e 1)
compulsi e beha io o clus e s o high (clus e s 3 and 4) compulsi e beha io .
- 1.726 (6%) o use s mo ed om clus e s o high compulsi e beha io o clus e s o ei he low
o medium compulsi e beha io .
- 5.141 (16%) o use s mo ed om clus e s o low compulsi e beha io o a clus e o medium
compulsi e beha io .
- 4.444 (14%) o use s mo ed om clus e s o medium compulsi e beha io o clus e s o low
compulsi e beha io .
A ew conclusions can be eached immedia ely by looking a hese numbe s, bu hey will be analyzed
mo e objec i ely in he Resul s sec ion o his wo k.
57
4. RESULTS AND DISCUSSIONS
This sec ion o he wo k will be dedica ed o he discussion o he inal esul s and o answe ing he
esea ch ques ions ha we e p esen ed in he In oduc ion.
One o he main objec i es o his wo k was o classi y online gambling use s in o clus e s based on
hei beha io . Th ough he applica ion o ML echniques, i became e iden ha hese use s can be
dis ibu ed based on some o hei gambling cha ac e is ics.
Ini ially, ML echniques we e applied o use da a om 2019 which was di ided in o i e clus e s.
Theses clus e s we e hen analyzed wi h he in en o iden i ying p o iles acco ding o he endency o
use s ha ing compulsi e gambling beha io . O he i e clus e s, wo we e associa ed wi h high
compulsi e beha io , ei he because o he equency o play o because o he ex emely nega i e
use balance. These wo clus e s ep esen oughly 8% o he o al use base in 2019.
The ML model ha was used wi h he 2019 use base, was also applied o he da a om 2020 in o de
o e alua e wha use beha io would look like du ing he mos es ic i e pe iod o lockdown in he
Co id-19 pandemic. The da a was, likewise, di ided in o i e clus e s ha we e analyzed acco ding o
he endency o ha ing compulsi e beha io . App oxima ely 12% o use s we e associa ed wi h high
compulsi e beha io , which ep esen s an inc ease by 50% when compa ed o use beha io in 2019.
Ano he conclusion ha can be eached by analyzing and compa ing clus e s om 2019 and 2020 is
ha clus e s om 2020 seem o be mo e ex eme. This can be no iced by analyzing, speci ically, he
clus e s associa ed wi h high compulsi e beha io .
In 2019 he clus e ha ep esen s use s ha ha e ex eme nega i e balance alues has a cen oid in
which he a e age balance alue is -125,04. In 2020 he equi alen clus e has a cen oid in which he
a e age balance alue is -138,89.
This can also be no iced in he clus e ha ep esen s use s ha play wi h ex eme equency. In 2019
his clus e has a cen oid in which he a e age numbe o days played is 191,86 and he a e age
numbe o hou s played is 3,87. In 2020 he equi alen clus e has a cen oid in which he a e age
numbe o days played is 262,77 and he a e age numbe o hou s played is 4,33.
Finally, when analyzing use s ha we e p esen in bo h he 2019 and he 2020 da ase s, i was possible
o iden i y he pe cen age o use s ha shi ed o di e en clus e s. By doing his, and conside ing he
2019 clus e s as he baseline, i was obse ed ha , du ing he lockdown pe iod, 43% o use s did no
change clus e s. O he emaining use s, 37% o use s shi ed o clus e s associa ed o mo e compulsi e
gambling beha io and 20% o use s shi ed o clus e s associa ed o less compulsi e beha io .
To summa ize, he esul s o his wo k, allow us o each he conclusion ha , du ing he mos
es ic i e pe iod o he lockdown, online gambling use s, ha a e associa ed o compulsi e beha io ,
became mo e ep esen a i e and, on a e age, may ha e de eloped e en mo e ex eme habi s.
In he ollowing sec ion, he esea ch ques ions ha ha e guided his wo k will be answe ed, in an
a emp o w ap up he mos ele an objec i es ha we e ini ially es ablished.
58
4.1. ANSWERING RESEARCH QUESTIONS
1. Is i possible o iden i y speci ic use beha io s (clus e s) based on he da a om 2019 ha
can es ablish online gambling diso de s?
By implemen ing unsupe ised ML echniques o use da a om 2019 i was possible o
iden i y clus e s o use s based on gambling habi s.
2. Also based on he da a om 2019, is i possible o iden i y a clus e o use s ha could be
associa ed wi h online gambling p oblems?
By pe o ming he p o iling o he clus e s, i was possible o iden i y clus e s o use s clea ly
associa ed o mo e compulsi e gambling beha io . One o hese clus e s is associa ed o a
highe equency o gambling and ano he is associa ed wi h a endency o lose la ge
mone a y amoun s.
3. By compa ing he segmen a ion esul s om 2019 and 2020 du ing he lockdown es ic ions
pe iod, has he e been a signi ican shi in clus e sizes?
By compa ing he clus e s ha we e gene a ed wi h da a om 2019 and clus e s ha we e
gene a ed wi h da a om 2020, i is possible o e i y ha he pe cen age o use s associa ed
o clus e s ha indica e addic i e beha io inc eased om 8% o 12%. This indica es ha hese
clus e s had a signi ican ly highe ep esen a ion in 2020, a leas du ing he mon hs o Ap il,
May, and June, which we e he mon hs in which ha she lockdown es ic ions had been
imposed in Po ugal.
4. Did playe s, on a e age, engage in mo e in ense gambling ac i i ies du ing he lockdown
es ic ion pe iods?
I was e i ied ha , on a e age, use s in 2019 played o 3 days each mon h and o 2.6 hou s
each day. In 2020 use s played, on a e age, o 7 days each mon h and o 2.7 hou s each day.
This means ha use s engaged in mo e in ense gambling ac i i ies du ing he mon hs o Ap il,
May and June o 2020 when compa ed o he gambling in ensi y in 2019.
5. Du ing he lockdown es ic ions pe iod, is i possible o de e mine i a ce ain numbe o
playe s om o he use clus e s mig a ed o clus e s o use s wi h po en ial gambling
diso de s?
Du ing he lockdown pe iod 37% o use s mig a ed o clus e s associa ed o mo e compulsi e
gambling beha io .
59
5. RECOMMENDATIONS FOR FUTURE WORK
Based on wha was de eloped du ing his wo k i is possible o build upon he acqui ed knowledge o
unde go u u e imp o emen s. A ew ecommenda ions will be lis ed below:
- This ype o analysis can be applied o o he equi alen ypes o online gambling ac i i ies,
such as spo ing be s and o he kinds o games o chance.
- The analysis can be hough o in e ms o indi idual gambling eco ds ins ead o consolida ed
use ac i i ies. By doing his i would be possible o e alua e gambling habi s based on i s
a ia ion h ough ime. This, howe e , would equi e ex emely highe compu a ional
capabili ies since i would in ol e s upendous amoun s o da a.
- O he ypes o ML models can be applied and he ones ha we e applied can be imp o ed
wi h al e na i e con igu a ion o he hype pa ame e s.
- The models ha we e applied o he da a can gene a e be e esul s and g ea e insigh s i
he da a is complemen ed wi h ca ego ical a iables ega ding he use s, such as: age, gende ,
ma i al s a us, geog aphic loca ion, and educa ion le el. Wi h his ype o in o ma ion, use s
can be be e classi ied, and his would help in iden i ying speci ic g oups o use s ha a e
mo e suscep ible o compulsi e gambling beha io .
60
6. BIBLIOGRAPHY
Agga wal, C. C. (2017). Ou lie Analysis. Sp inge .
Alam, M. (2020). S a is ical echniques o anomaly de ec ion - Fi e s a is ical ools o apid
assessmen o anomalies and ou lie s. Re ie ed June 24, 2021, om Towa ds Da a Science:
h ps:// owa dsda ascience.com/s a is ical- echniques- o -anomaly-de ec ion-
6ac89e32d17a
Amelia, A. (2018). Re ie ed Augus 30, 2021, om Towa ds Da a Science:
h ps:// owa dsda ascience.com/k-means-clus e ing- om-a- o-z- 6242a314e9a
Bação, F., Lobo, V., & Painho, M. (2005). Sel -o ganizing Maps as Subs i u es o K-Means. In:
Sunde am V.S., an Albada G.D., Sloo P.M.A., Donga a J. (eds) Compu a ional Science –
ICCS 2005. ICCS 2005. Lec u e No es in Compu e Science, ol 3516. Sp inge , Be lin,
Heidelbe g. h ps://doi.o g/10.1007/11428862_65
Bhanda i, A. (2020). Fea u e Scaling o Machine Lea ning: Unde s anding he Di e ence Be ween
No maliza ion s. S anda diza ion. Re ie ed June 27, 2021, om Analy ics Vidhya:
h ps://www.analy ics idhya.com/blog/2020/04/ ea u e-scaling-machine-lea ning-
no maliza ion-s anda diza ion/
Bi ke , A. (2019). How o Deal wi h Ou lie s in You Da a. Re ie ed June 25, 2021, om CXL:
h ps://cxl.com/blog/ou lie s/
Bishop, C. M. (2006). Pa e n Recogni ion and Machine Lea ning. Sp inge .
Bock, T. (n.d.). Wha a e he S eng hs and Weaknesses o Hie a chical Clus e ing? Re ie ed Augus
19, 2021, om DisplayR: h ps://www.display .com/s eng hs-weaknesses-hie a chical-
clus e ing/
B i annica. (n.d.). A i icial In elligence. Re ie ed June 15, 2021, om
h ps://www.b i annica.com/ echnology/a i icial-in elligence
B ownlee, J. (2016). Machine Lea ning Mas e y Wi h Py hon - Unde s and You Da a, C ea e Accu a e
Models and Wo k P ojec s End-To-End. Jason B ownlee.
Calado, F., & G i i hs, M. D. (2016). P oblem gambling wo ldwide: An upda e and sys ema ic e iew
o empi ical esea ch (2000–2015).
Cla k, L. (2014). Diso de ed gambling: he e ol ing concep o beha io al addic ion.
Clemen s, J. (2019). In oduc ion o Hie a chical Clus e ing - Unco e ing S uc u e in S a e-le el
Demog aphic Da a in R. Re ie ed Augus 18, 2021, om Towa ds Da a Science:
h ps:// owa dsda ascience.com/in oduc ion-hie a chical-clus e ing-d3066c6b560e
Domingos, P. (2015). The Mas e Algo i hm - How he Ques o he Ul ima e Lea ning Machine Will
Remake Ou Wo ld. Basic Books.
61
Eu opean Comission. (2012). COMMUNICATION FROM THE COMMISSION TO THE EUROPEAN
PARLIAMENT, THE COUNCIL, THE ECONOMIC AND SOCIAL COMMITTEE AND THE COMMITTEE
OF THE REGIONS - Towa ds a comp ehensi e Eu opean amewo k o online gambling.
Re ie ed June 15, 2021, om h ps://eu -lex.eu opa.eu/legal-
con en /EN/TXT/PDF/?u i=CELEX:52012DC0596& om=ET
Gala nyk, M. (2018). Unde s anding Boxplo s. Re ie ed June 25, 2021, om Towa ds Da a Science:
h ps:// owa dsda ascience.com/unde s anding-boxplo s-5e2d 7bcbd51
Gé on, A. (2019). Hands-on Machine Lea ning wi h Sciki -Lea n, Ke as, and Tenso Flow - Concep s,
Tools, and Techniques o Build In elligen Sys ems. O’Reilly Media, Inc.
Gup a, A. (2021). Elbow Me hod o op imal alue o k in KMeans. Re ie ed No embe 02, 2021,
om Geeks o Geeks: h ps://www.geeks o geeks.o g/elbow-me hod- o -op imal- alue-o -
k-in-kmeans/
Håkansson, A. (2020). Impac o COVID-19 on Online Gambling – A Gene al Popula ion Su ey Du ing
he Pandemic. Re ie ed June 15, 2021, om
h ps://www. on ie sin.o g/a icles/10.3389/ psyg.2020.568543/ ull
Han, J., Kambe , M., & Pei, J. (2012). Da a Mining Concep s and Techniques. Else ie .
Hen iques, R., Lobo, V., & Bação, F. (2012). Spa ial Clus e ing Using Hie a chical SOM. In Applica ions
o Sel -O ganizing Maps, Magnus Johnsson, In echOpen. doi:10.5772/51159
Jain, A. K., Mu y, M. N., & Flynn, P. J. (1999). Da a Clus e ing: A Re iew.
Kassamba a, A. (n.d.). K-Medoids in R: Algo i hm and P ac ical Examples. Re ie ed No embe 02,
2021, om Da a No ia: h ps://www.da ano ia.com/en/lessons/k-medoids-in- -algo i hm-
and-p ac ical-examples/
KHAZRI, A. (2019). Sel O ganizing Maps (Kohonen’s maps). Re ie ed Sep embe 03, 2021, om
Towa ds Da a Science: h ps:// owa dsda ascience.com/sel -o ganizing-maps-1b7d2a84e065
Kho, J. (2019). Anno a ed Hea maps o a Co ela ion Ma ix in 5 Simple S eps. Re ie ed July 01,
2021, om Towa ds Da a Science: h ps:// owa dsda ascience.com/anno a ed-hea maps-in-
5-simple-s eps-cc2a0660a27d
Kuma , S. (2020). Fea u e Enginee ing — deep di e in o Encoding and Binning echniques. Re ie ed
June 29, 2021, om Towa ds Da a Science: h ps:// owa dsda ascience.com/ ea u e-
enginee ing-deep-di e-in o-encoding-and-binning- echniques-5618d55a6b38
Kuma , S. (2020). Hie a chical Clus e ing: Agglome a i e and Di isi e — Explained - An o e iew o
agglome a ion and di isi e clus e ing algo i hms and hei implemen a ion. Re ie ed Augus
17, 2021, om Towa ds Da a Science: h ps:// owa dsda ascience.com/hie a chical-
clus e ing-agglome a i e-and-di isi e-explained-342e6b20d710
Kuma , S. (2021). How o know which S a is ical Tes o use o Hypo hesis Tes ing? - When o use
which es — T- es , Chi-squa e Tes , ANOVA. Re ie ed July 01, 2021, om Towa ds Da a
62
Science: h ps:// owa dsda ascience.com/how- o-know-which-s a is ical- es - o-use- o -
hypo hesis- es ing-744c91685a5d
LZP, J. (2019). Dis ance Measu es and Linkage Me hods In Hie a chical Clus e ing. Re ie ed Augus
18, 2021, om Gi connec ed: h ps://le elup.gi connec ed.com/dis ance-measu es-and-
linkage-me hods-in-hie a chical-clus e ing-8b7d488d7ebc
Madsen, J. H. (2018). Ou lie de ec ion o imp o ed clus e ing : empi ical esea ch o unsupe ised
da a mining. Re ie ed om h p://hdl.handle.ne /10362/34464
Mi chell, T. M. (1997). Machine Lea ning. McG aw-Hill Science/Enginee ing/Ma h.
Pa el, A. A. (2019). Hands-On Unsupe ised Lea ning Using Py hon - How o Build Applied Machine
Lea ning Solu ions om Unlabeled Da a. O’Reilly Media, Inc.
Piech, C. (2013). K Means. Re ie ed Augus 24, 2021, om S an o d:
h ps://s an o d.edu/~cpiech/cs221/handou s/kmeans.h ml
Radečić, D. (2021). How o Make S unning Rada Cha s wi h Py hon — Implemen ed in Ma plo lib
and Plo ly - Easily isualize da a beyond he 2nd dimension wi h Rada Cha s —
implemen ed in bo h Ma plo lib and Plo ly. Re ie ed Oc obe 05, 2021, om Towa ds Da a
Science: h ps:// owa dsda ascience.com/how- o-make-s unning- ada -cha s-wi h-py hon-
implemen ed-in-ma plo lib-and-plo ly-91e21801d8ca
Russell, S. J., & No ig, P. (2010). A i icial In elligence - A Mode n App oach. Pea son Educa ion.
Selec ing he numbe o clus e s wi h silhoue e analysis on KMeans clus e ing - sciki -lea n 1.0.1
documen a ion. (n.d.). Re ie ed No embe 02, 2021, om h ps://sciki -
lea n.o g/s able/au o_examples/clus e /plo _kmeans_silhoue e_analysis.h ml
Sha ma, P. (2019). The Mos Comp ehensi e Guide o K-Means Clus e ing You’ll E e Need. Re ie ed
Augus 24, 2021, om Analy ics Vidhya:
h ps://www.analy ics idhya.com/blog/2019/08/comp ehensi e-guide-k-means-clus e ing/
sklea n.clus e .Kmeans - sciki -lea n 1.0.1 documen a ion. (n.d.). Re ie ed No embe 02, 2021, om
h ps://sciki -lea n.o g/s able/modules/clus e ing.h ml#k-means
sklea n.neighbo s.KNeighbo sClassi ie -sciki -lea n 1.0.1 documen a ion. (n.d.). Re ie ed om
h ps://sciki -
lea n.o g/s able/modules/gene a ed/sklea n.neighbo s.KNeighbo sClassi ie .h ml
SRIJ. (2018). Se iço de Regulação e Inspeção de Jogos. Re ie ed om
h ps://s ij. u ismodepo ugal.p /p /
Tu ismo de Po ugal. (2019). A i idade do Jogo Online em Po ugal - 4º T imes e de 2019. Re ie ed
June 15, 2021, om
h ps://www.s ij. u ismodepo ugal.p / o os/edi o 2/es a is icas/Rela o io_4_ imes e_201
9_Jogo_Online_PT.PDF
Whelan, C., Ha ell, G., & Wang, J. (2015). Unde s anding he K-Medians P oblem.
63
Whi e, T. (2015). Hadoop: The De ini i e Guide. O’Reilly Media, Inc.
Widmann, M., & Heine, M. (2018). Fou Techniques o Ou lie De ec ion. Re ie ed June 24, 2021,
om Knime: h ps://www.knime.com/blog/ ou - echniques- o -ou lie -de ec ion
Yiu, T. (2019). The Cu se o Dimensionali y - Why High Dimensional Da a Can Be So T oublesome.
Re ie ed June 28, 2021, om Towa ds Da a Science: h ps:// owa dsda ascience.com/ he-
cu se-o -dimensionali y-50dc6e49aa1e
Zai , M., Rahmoune, C., & Benazzouz, D. (2018). Mul i- aul diagnosis o olling bea ing using uzzy
en opy o empi ical mode decomposi ion, p incipal componen analysis, and SOM neu al
ne wo k.