# ClusteringComponents returning only ones

I am trying to use ClusteringComponents without having to specify the number of clusters initially... so the algorithm can find itself the optimal number of clusters...

My data is of the form:

x=RandomReal[10, {100, 63}]


I am trying a command of the form:

cl = ClusteringComponents[RandomReal[10, {100, 63}],
DistanceFunction -> CorrelationDistance, Method -> "KMeans"];


The return value is wrong and is a bunch of 1's in a nested list...

If you specify the Level as 1, you get two components:

x=RandomReal[10, {100, 63}];
cl = ClusteringComponents[RandomReal[10, {100, 63}], Automatic, 1,
DistanceFunction -> CorrelationDistance, Method -> "KMeans"]
(* {1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 2, 2, 1, 2,
1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 2, 1,
1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2,
2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1}*)

clx = Transpose[ConstantArray[cl, {63}]];
Overlay[{ArrayPlot[x, ImageSize -> 400, AspectRatio -> 1],
ArrayPlot[clx, ImageSize -> 400, AspectRatio -> 1,
ColorRules -> {1 -> Directive[Opacity[.5], Red],
2 -> Directive[Opacity[.5], Green]}]}]


FWIW, if you remove the DistanceFunction option, you also get two clusters (at level 2):

clB = ClusteringComponents[RandomReal[10, {100, 63}], Method -> "KMeans"];
ComponentMeasurements[clB, "Label"]
(* {1 -> 1,2 -> 2} *)
Overlay[{ArrayPlot[x, ImageSize -> 400, AspectRatio -> 1],
ArrayPlot[clB, ImageSize -> 400, AspectRatio -> 1,
ColorRules -> {1 -> Directive[Opacity[.5], Red],
2 -> Directive[Opacity[.5], Green]}]}]