i took some code i had for performing k-means clustering and made it into a proper class. i also found Dan Stowell's KMeans quark and borrowed some concepts from that one. my version works slightly different and uses
RedVectors of any dimension.
the class is part of my redUniverse quark and the best way to install it is as always to from within supercollider type...
Quarks.install("redUniverse"); and then recompile. a helpfile and simple examples are included but i hope to write more elaborate demonstrations of this later on.
this is a screenshot from the example in the
RedKMeans helpfile. 1000 random points are categorised into 5 groups/clusters. the bigger circles are the 5 mean points/centroids.
also see 190-kmeans.scd for an example running in realtime.