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


Flattens a list.


>>> flatten([a,b,[c,d,[e,f]]])

Completely flattens out a cluster and returns a one-dimensional 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.

calculates the magnitude of a vecor


Returns the arithmetic mean of a numeric list. see:


Return the median of the list of numbers. see:

cluster.util.minkowski_distance(x, y, p=2)

Calculates the minkowski distance between two points.

  • 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.