comparison python/ml.py @ 386:8bc632cb8344

minor
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 23 Jul 2013 05:05:06 -0400
parents ba813f148ade
children c81cbd6953fb
comparison
equal deleted inserted replaced
385:1917db662aa7 386:8bc632cb8344
51 def draw(self, options = ''): 51 def draw(self, options = ''):
52 from matplotlib.pylab import text 52 from matplotlib.pylab import text
53 self.instance.draw(options) 53 self.instance.draw(options)
54 text(self.instance.position.x+1, self.instance.position.y+1, str(self.nInstances)) 54 text(self.instance.position.x+1, self.instance.position.y+1, str(self.nInstances))
55 55
56 def kMedoids(similarityMatrix, initialCentroids = None, k = None):
57 '''Algorithm that clusters any dataset based on a similarity matrix
58 Either the initialCentroids or k are passed'''
59 pass
56 60
57 def assignCluster(data, similarFunc, initialCentroids = [], shuffleData = True): 61 def assignCluster(data, similarFunc, initialCentroids = [], shuffleData = True):
58 '''k-means algorithm with similarity function 62 '''k-means algorithm with similarity function
59 Two instances should be in the same cluster if the sameCluster function returns true for two instances. It is supposed that the average centroid of a set of instances can be computed, using the function. 63 Two instances should be in the same cluster if the sameCluster function returns true for two instances. It is supposed that the average centroid of a set of instances can be computed, using the function.
60 The number of clusters will be determined accordingly 64 The number of clusters will be determined accordingly