摘要: 前面写的JAVA版的KMEANS比较恶心,现在补上一个简单的python版本。#kmeansimport mathdef doKmeansCluster(data, cnum, itnum): c = data[:cnum] for time in range(itnum): groups = [[] for i in range(len(c))] for d in data: min = distance(d,c[0]) index = 0 for i in range(len(c)):... 阅读全文
posted @ 2012-08-12 21:36 tadoo 阅读(361) 评论(0) 推荐(0) 编辑