# Time Series Clustering of Online Gambling Activities for Addicted Users' Detection
## 4 Results and Discussion
### Sports Dataset  
After obtaining the time series data set through the data preparation phase, the time series \(k\)-means algorithm was applied. The elbow method was firstly executed to get an indication on the optimal number of clusters to form. As suggested in Figure 1, the most suitable values for \(k\) are four or five. Subsequently, the silhouette score was calculated for these two values, obtaining for \(k=4\) a value of 0.620 and for \(k=5\) a value of 0.317. These two positive values indicate that both clustering configurations are appropriate, but the first score is almost double with respect to the second one. For this reason, we selected \(k=4\) for executing the time series \(k\)-means algorithm. After applying the algorithm, we obtained four clusters with observations distributed as follows:  
* Cluster 0: 140 time series
* Cluster 1: 1086 time series
* Cluster 2: 13,390 time series
* Cluster 3: 467 time series Figure 2 shows, for each cluster, the box plots related to the number of bets placed, the total amount spent, the average of the maximum amount waged, and the final balance of a player. As one can see, the number of bets placed by a player is significantly higher in Clusters 0 and 3, with respect to Clusters 1 and 2. Similarly, the total amount spent on bets presents the same kind of behavior. This is a first indication that Clusters 0 and 3 are composed of players with a high propensity to play. However, there is a fundamental difference between these two groups: players belonging to Cluster 0 tend to be much more money, as confirmed by the box plots related to the total amount spent and the maximum amount waged. Players who form Clusters 1 and 2, on the other hand, tend to place fewer bets with relatively low amounts. We could therefore say that Cluster 1 contains occasional players and Cluster 2 regular players who do not exaggerate the number of bets placed and amounts spent. Another important thing to notice comes from the box plot of final balances: occasional and regular players tend to gain or lose relatively small amounts with an almost symmetrical distribution with respect to zero. On the other hand, most of the players that compose Clusters 0 and 3 tend to lose more money than the previous two clusters. However, the proportion of players with a negative balance is significantly higher in Cluster 0. Figure 1: Elbow method plot on sports bets’ data using the time series \(k\)-means algorithm. The indications obtained from the box plots are confirmed by the histograms presented in Figures 3-5, which represent, for each cluster, the distributions of the number of bets placed, the total amount spent, and the final balance of a player. It is very interesting to observe in Figure 5 the distribution of the final balance in Cluster 0 and Cluster 3, which clearly highlights a greater presence of looser gamblers in Cluster 0. Figure 2: Box plots for sports bets’ data obtained using the time series \(k\)-means algorithm. Figure 4: Histograms of the total amount spent obtained using the time series \(k\)-means algorithm. The x axis reports the amount spent, while the y axis shows the number of players that spent that amount during the month. Figure 3: Histograms of the number of bets obtained using the time series \(k\)-means algorithm. The x axis reports the number of bets, while the y axis shows the number of players that have performed that number of bets during the month. It is also important to inspect the relationships of the final balance with respect to the number of bets placed and the amount spent presented in Figure 6. From these plots, we can observe two things:  
* gamblers who have a positive balance tend to have a low number of placed bets, while only a few players who place many bets actually win. * gamblers who have a positive balance tend to have a lower amount spent compared to most players in the same cluster; only a few players who invest much money get a positive balance, which is usually very high.