8

Currently I made some slides to illustrate clustering. As an example I made a point set of two clusters:

   {clusters, graph} = Block[{c1, c2, cluster1, cluster2},
   c1 = {1, 2}; 
   cluster1 = (# + c1) & /@ 
     RandomVariate[NormalDistribution[0, 0.5], {10^3, 2}];
   c2 = {3, 3}; 
   cluster2 = (# + c2) & /@ 
     RandomVariate[NormalDistribution[0, 0.5], {10^3, 2}];
   {clusters = Union[cluster1, cluster2],
    Graphics[{{Green, Point[cluster1]}, {Red, Point[cluster2]}}, 
     Frame -> True]}
   ];
graph

which looks somewhat like:

enter image description here

Mathematica is a powerful tool, so I tried a naive approach

cls = FindClusters[clusters];

... and got:

enter image description here

Further "experiments" like

FindClusters[clusters, DistanceFunction -> EuclideanDistance]

were all not successful. What worked immediately is

FindClusters[clusters, Method -> "Optimize"]

which delivers:

enter image description here

But the method "Optimize" is removed from documentation, see Question addressing FindClusters

So the question is: Is there an easy way to find the (obvious) clusters in that case without putting parts of the "solution" (two clusters) in the options of FindClusters?

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
mgamer
  • 5,593
  • 18
  • 26

0 Answers0