Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cluster_centers(self,X):
- listOfClusters = []
- result = []
- for i in self.clusters:
- listOfClusters.append(self.cluster_list(X,i))
- for ei in listOfClusters:
- sum = [0]
- count = 0
- for ej in ei[1:]:
- sum += ej
- count += 1
- result.append(sum/count)
- return np.array(result)
- def SumSquaredError(self,X):
- sse = 0
- for i in self.clusters:
- sse = np.sum((self.cluster_list(X,i) - self.cluster_centers(X)[i])**2)
- return sse
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement