def cluster(matrix):
whitened = whiten(matrix.todense())
# for x in range(25, 40):
# means, distortion = kmeans(whitened, x)
# print distortion
means, distortion = kmeans(whitened, 30)
# pickle.dump(means, open('30means-' + sys.argv[1] + '.pkl', 'wb'))
return means, distortion
评论列表
文章目录