def quantize(self):
clusters = range(self.centroids.shape[0] + 1)
histograms = {}
for fname in sorted(self.data.keys()):
if self.data[fname] is None: continue
idx,_ = vq(self.data[fname], self.centroids)
histograms[fname], _ = np.histogram(idx, bins=clusters, normed=self.normalize)
return histograms
评论列表
文章目录