# Looking for an algorithm that correctly clusters visually separable clusters

I have visualized a dataset in 2D after employing PCA. As 2D visualization shows in figure, there is a good separation between points (A, B). Now, I want to use a metric which can separate these points (between these 2 PC components not in main dataset) too. I mean have separation between these PCA components without visualization. I used some clustering methods but they raise false positives. I mean they miss cluster many points.

Also, as shown in histogram there is a gap between points A,B. Does this help in devising any metric?

I will be so grateful if you can introduce me any method and algorithm to be able to do separation between A and B.

• Hi, if my answer clarified your understanding of classification methods, may I ask you to upvote my answer? :) – VividD May 18 '17 at 3:42

With appropriate parameters, DBSCAN and single linkage hierarchical agglomerative clustering should work very well. Epsilon=0.2 or so.

But why? You know the data, just use a threshold.

If you just want an algorithm to "confirm" your desired outcome then you are using it wrong. Be honest: if you want your result to be "if $F-factor-1 > 1.5 then cluster1 else cluster2", then just say so, instead of attempting to find a clustering algorithm to fit to your desired solution! • Thank you. No, this is not my only figure. I have many figures like this and visualization will take so much space in my work. Therefore, I need a good algorithm to work as visualization. Yes, DBSCAN with Epsilon=0.05 works well but single linkage is so poor in this issue. What is the point in selecting Epsilon? Btw, Do you know any open source tool that has OPTICS ? – Arkan Jul 29 '16 at 22:01 • OPTICS works well for me. I use the ELKI version, which is the only feature-complete version I know. It's open source. – Has QUIT--Anony-Mousse Jul 29 '16 at 22:57 This picture from scikit-learn may help you get insight what methods would yield good result in your case, and what wouldn't, and why. Using k-means clustering algorithm on this dataset should work perfectly fine. You just have to pass the (n_samples, 2) matrix where element$(i,j)\$ represents the j-th coordinate of sample i in the PCA to any k-means algorithm, and specify that you want 2 clusters, and Euclidean metric.

• Thank you for your reply. No. It is not good at all. It miss cluster many points. it clusters about half of points in one cluster and the half in another cluster. – Arkan Jul 29 '16 at 9:13
• Ok, how about hierarchical clustering ? You will have to cut the tree at 2 clusters. – Syzygyyy Jul 29 '16 at 9:15
• k-means with 2 clusters does not work for this dataset, because samples in visual section A can be closer to any centroid in B than they are to a centroid in A. – Neil Slater Jul 29 '16 at 10:29