# FindClusters versus ClusteringComponents?

GROUPS:
 Jan Baetens 3 Votes 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
4 months ago
4 Replies
 Giorgia Fortuna 7 Votes FindClusters and ClusteringComponents have gone under massive reconstruction. However, when calling Method->"Optimize" you use the old ones. The old FindClusters/ClusteringConponents were not using the same algorithms on the back, that is the reason why you got different results. 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}