I used K-means to get the number of clusters for my data(Elbow Method). Then I was trying to see if for some specific hyperparameters can we get the same number of clusters for DBSCAN. I tried Brute-Force to get the parameter values and got some value for different data sets.

However, I was wondering if there is a justification for this or whether it's just a fluke?

Edit- All the datasets are 2-dimensional.


1 Answer 1


First of all K-means is a partitioning algorithm where as DBSCAN is a Density clustering algorithm.

K-means tries to find cluster centers that are representative of certain regions of the data. DBSCAN doesn’t require every point be assigned to a cluster and hence doesn’t partition the data, but instead extracts the dense clusters and leaves sparse background classified as noise. It use the concept of reachability i.e. how many neighbors has a point within a radius.

If suppose by bruteforce you get same number of clusters but Rand_score will be quite different having said that if the dataset is quite trivial ( we get clusters of data point equally far from each other and equally dense) both will get same number of clusters.

  • $\begingroup$ Edited the question a bit. Currently, the dataset was quite small, around 300 rows with 2/3 features. But for 2D datasets, can we say something about the similarity of DBSCAN and K-Means? Note that I am not comparing a random partition with DBSCAN, because otherwise obviously it won't work. However, for some kind of optimal partitioning, can DBSCAN predict the same number of clusters for the 2D dataset? $\endgroup$ Jul 27, 2020 at 23:48
  • $\begingroup$ K-means algorithm works best when all the three assumptions are held. K-means assumes clusters are globular so it can't handle outliers. Some of that problem can be solved by DBSCAN but it is very sensitive to parameters like if your data has variable density clusters then DBSCAN is either going to miss them, split them up, or lump some of them together depending on your parameter choices. So, we can't say anything about their similarity it all depends on data. $\endgroup$ Jul 28, 2020 at 6:49
  • $\begingroup$ I get it what you are trying to say. That's why I specified that I am looking at some sort of optimal clusters through K-means and then using brute force to get the parameters for DBSCAN which largely affects the clustering algorithm. So, another way to pose my question is: Is there a way to mathematically relate density-based circles/clusters to partitioning based on one large circle (K-means). In other words, is there a counterexample, in which, the data has 'n' "optimal" partitions with K-Means but DBSCAN can never get those cluster numbers? $\endgroup$ Jul 28, 2020 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.