quick look at machine learning types example and cluster class example will be used to build the samples to be clustered associated with each example is namea feature vectorand an optional label the distance method returns the euclidean distance between two examples class example(object)def __init__(selfnamefeatureslabel none)#assumes features is an array of numbers self name name self features features self label label def dimensionality(self)return len(self featuresdef getfeatures(self)return self features[:def getlabel(self)return self label def getname(self)return self name def distance(selfother)return minkowskidist(self featuresother getfeatures() def __str__(self)return self name +':'str(self features':str(self labelfigure class example class clusterfigure is slightly more complex think of cluster as set of examples the two interesting methods in cluster are computecentroid and variance think of the centroid of cluster as its center of mass the method computecentroid returns an example with feature vector equal to the euclidean mean of the feature vectors of the examples in the cluster the method variance provides measure of the coherence of the cluster