cluster.util¶

exception
cluster.util.
ClusteringError
¶ Bases:
exceptions.Exception

cluster.util.
centroid
(data, method=<function median>)¶ returns the central vector of a list of vectors

cluster.util.
dotproduct
(a, b)¶ Calculates the dotproduct between two vecors

cluster.util.
flatten
(L)¶ Flattens a list.
Example:
>>> flatten([a,b,[c,d,[e,f]]]) [a,b,c,d,e,f]

cluster.util.
fullyflatten
(container)¶ Completely flattens out a cluster and returns a onedimensional set containing the cluster’s items. This is useful in cases where some items of the cluster are clusters in their own right and you only want the items.
Parameters: container – the container to flatten.

cluster.util.
magnitude
(a)¶ calculates the magnitude of a vecor

cluster.util.
mean
(numbers)¶ Returns the arithmetic mean of a numeric list. see: http://mail.python.org/pipermail/pythonlist/2004December/294990.html

cluster.util.
median
(numbers)¶ Return the median of the list of numbers. see: http://mail.python.org/pipermail/pythonlist/2004December/294990.html

cluster.util.
minkowski_distance
(x, y, p=2)¶ Calculates the minkowski distance between two points.
Parameters:  x – the first point
 y – the second point
 p – the order of the minkowski algorithm. If p=1 it is equal to the manhatten distance, if p=2 it is equal to the euclidian distance. The higher the order, the closer it converges to the Chebyshev distance, which has p=infinity.