You can clone with
Cannot retrieve contributors at this time
DESCRIPTION===========python-cluster is a "simple" package that allows to create several groups(clusters) of objects from a list. It's meant to be flexible and able tocluster any object. To ensure this kind of flexibility, you need not only tosupply the list of objects, but also a function that calculates the similaritybetween two of those objects. For simple datatypes, like integers, this can beas simple as a subtraction, but more complex calculations are possible. Rightnow, it is possible to generate the clusters using a hierarchical clusteringand the popular K-Means algorithm. For the hierarchical algorithm there aredifferent "linkage" (single, complete, average and uclus) methods available. Iplan to implement other algoithms as well on an"as-needed" or "as-I-have-time" basis.Algorithms are based on the document found athttp://www.elet.polimi.it/upload/matteucc/Clustering/tutorial_html/USAGE=====A simple python program could look like this:: >>> from cluster import * >>> data = [12,34,23,32,46,96,13] >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y)) >>> cl.getlevel(10) # get clusters of items closer than 10 [96, 46, [12, 13, 23, 34, 32]] >>> cl.getlevel(5) # get clusters of items closer than 5 [96, 46, [12, 13], 23, [34, 32]]Note, that when you retrieve a set of clusters, it immediately starts theclustering process, which is quite complex. If you intend to create clustersfrom a large dataset, consider doing that in a separate thread.For K-Means clustering it would look like this: >>> from cluster import KMeansClustering >>> cl = KMeansClustering([(1,1), (2,1), (5,3), ...]) >>> clusters = cl.getclusters(2)The parameter passed to getclusters is the count of clusters generated.