Message Boards Message Boards

FindClusters versus ClusteringComponents?

GROUPS:

Dear all,

I just found out that there's a difference in the number clusters retrieved when using FindClusters and ClusteringComponents for the same data set, even when completely the same settings are used:

Do[
koppels = RandomReal[{0, 100}, 500];
cl = FindClusters[koppels, DistanceFunction -> EuclideanDistance, Method -> "Optimize"];
indices2 = ClusteringComponents[koppels, Automatic, 1,  DistanceFunction -> EuclideanDistance, Method -> "Optimize"];
Print[{First@Dimensions[cl], Max[indices2]}];, 
{i, 1, 6}]

{2,2}

{2,2}

{1,2}

{2,2}

{1,2}

{1,2}

This shouldn't be the case, because the same clusters should be found either way.

Does someone have an idea of what's going on here?

Thanks for the information!

Jan

POSTED BY: Jan Baetens
Answer
11 months ago

FindClusters and ClusteringComponents have gone under massive reconstruction. However, when calling Method->"Optimize" you use the old ones.

  1. The old FindClusters/ClusteringConponents were not using the same algorithms on the back, that is the reason why you got different results.

  2. The new ones give the same result (see below).

If you look at the documentation of these functions you will notice that the method "Optimize" has been removed. The reason being that ideally we don't want the user to use the old code ever. However for back compatibility we need to accept this method.

Do[koppels = RandomReal[{0, 100}, 500];
 cl = FindClusters[koppels, DistanceFunction -> EuclideanDistance];
 indices2 = 
  ClusteringComponents[koppels, Automatic, 1, 
   DistanceFunction -> EuclideanDistance];
 Print[{First@Dimensions[cl], Max[indices2]}];, {i, 1, 6}]

{5,5}

{5,5}

{6,6}

{6,6}

{5,5}

{5,5}

POSTED BY: Giorgia Fortuna
Answer
11 months ago

Thanks. This information solved our issue completely!

POSTED BY: Jan Baetens
Answer
11 months ago
POSTED BY: Alexey Popkov
Answer
6 months ago

And now don't forget about ClusterClassify either ;-)

POSTED BY: Sam Carrettie
Answer
6 months ago

Group Abstract Group Abstract