Subject: | Implementation of clustering is broken |
This module fails to produce clusters at all for my data, it always
returns a single cluster with all the data in it. After a LOT of
debugging I found out why. In _move_centroids it is attempting to create
a centroid of all the vectors in a cluster, by adding up all the data
points and then dividing..... by the number of data keys, instead of the
number of items in the cluster.
In short replace line 121 with:
map { $new_centroid{$_} /= scalar( @$cluster ) }