Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

There is an error in Problem Set 10. File ps10.py > Class Cluster > Function computeCentroid # Corrected def computeCentroid(self): dim = self.points[0].dimensionality() totVals = pylab.array([0.0]*dim) totVals2 = pylab.array([0.0]*dim) for p in self.points: totVals += p.getAttrs() totVals2 += p.getOriginalAttrs() meanPoint = self.pointType('mean', totVals2/float(len(self.points)), totVals/float(len(self.points))) return meanPoint

OpenStudy (anonymous):

that is not a mistake. the centroid point is the mean vector of a cluster - it has no need for unNormalized data. All the functions that make use of it (the centroid) are using Normalized data. No need for your correction.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!