Assignment 3, question 3 & 4
Johanna Wiberg (jwiberg):18 hours in total both this file and the other one
Oscar Forsberg (oscfors): 18 hours in total both this file and the other one
To start of this part of the assignment we used a k-distance graph in order to get the optimal value for epsilon. (source 1, which can be find further down)
As you can see on the graph, the slope is increasing the most at ~3.5. So an epsilon around there is optimal according to this method. (source 1 & 2) Choosing a minPts is a bit harder since it requires domain knowledge. But we also found sources (3 & 4) saying that the starting point is to pick minPts as at least 4 for 2-dimensional data, but also that minPts can be higher when dealing with large datasets. We assumed our dataset to be large so in the end we went for a minPts = 5. So we start of with testing epsilon = 3.5 and min_Sample = 5.
Source 1: https://www.analyticsvidhya.com/blog/2020/09/how-dbscan-clustering-works/
Source 2: https://towardsdatascience.com/explaining-dbscan-clustering-18eaf5c83b31
Source 3: http://www.sefidian.com/2020/12/18/how-to-determine-epsilon-and-minpts-parameters-of-dbscan-clustering/
Source 4: https://medium.com/@tarammullin/dbscan-parameter-estimation-ff8330e3a3bd
Iteration 1 Number of outliers: 1152 Number of clusters: 93 Clusters (colored) and outliers (black)
As you can see on the graph and text above we have 93 clusters, which by looking at the way the data looks doesn't seem reasonable at all. Visually you can see around 3-6 clusters. We therefore want fewer clusters, so we increase min_Sample and try to solve this iteratively.
Iteration 2 Number of outliers: 5858 Number of clusters: 12 Clusters (colored) and outliers (black)
What happens when we increase the min_samples is that we get fewer clusters but a lot of outliers => so we need to increase the epsilon in order to increase the radius of the clusters. We therefore set epsilon to 10.
Iteration 3 Number of outliers: 1168 Number of clusters: 6 Clusters (colored) and outliers (black)
Now we get a much more realistic result! So this will be our graph! Number of outliers are the black data points in the graph and they are 1168. Below you can see the bar graph with the outliers, the most common one by far is GLY.
The cluster does look pretty different. The biggest difference in our opinion is that the DBSCAN considers outliers/noise. This makes the clusters more dense. The clusters for DBSCAN are also more circle-like compared to the K-means clusters. If you for example look at the graph for k-means where k=5, the "blob" in the top right corner is split half into two clusters. Which doesn't seem totally realistic. However, with the K-means method it's pretty easy to find the right parameter using the elbow method. But for DBSCAN you have to choose two parameters and they are both quite dependent on each other.
The clusters are not robust and it seems as though the smaller the cluster the less robust it is. If we for example increase the Min_sample to 35, the dark green clusters disappear and become outliers. This is because it's not a lot of data points around that area so there will not be 35 data points within the epsilon distance. If we instead decrease the min_sample more clusters will appear. If we decrease the epsilon to 7, we get more outliers and more clusters. If we increase the epsilon to 13, we get more clusters and less outliers. The conclusion here is that the DBSCAN is very dependent on the parameters. Changing a parameter with a few steps makes pretty big differences so it's hard to know if you can trust the result.
GLY clusters Number of outliers: 310 Number of clusters: 8 Clusters (colored) and outliers (black)
PRO clusters Number of outliers: 44 Number of clusters: 3 Clusters (colored) and outliers (black)
The GLY is pretty similar to the general clusters. The only big difference is that the big blob in the right top corner is split up into two blobs for GLY. As you can see on the graph with only PRO, it seems as though many of the data points who "connect" the two blobs in the right top corners are PRO data points. The clusters for PRO differ quite a lot for the general graph with clusters. They are pretty centered around -100 to -50 on the Phi axis and spread out on the psi axis, with a tendency to be between -50 to 180.