This plugin makes it very easy to cluster active record objects. It uses the clusterer Ruby gem.
Download and install the gem, and its dependencies. Copy the plugin into vendor/plugins from the following svn repository
Add the following lines to your model:
acts_as_clusterable :fields => ['title','text']
If no fields are given then it will use all text and string fields present in the model.
Now, doing clustering is as easy as:
By default the number of clusters is Math.sqrt(no. of objects). To get custom no. of clusters give the method the no. of clusters as an argument, i.e.,
For better results use hierarchical clustering, for faster results use kmeans.
Update: New release Clusterer + other plugins