摘要:
前面写的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)):... 阅读全文