def splitclusters(datapointwts,seeds,theta):
std = {}; seeds1 = []; seedweight = [];
cluster, p2cluster = point2cluster(datapointwts, seeds,theta);
for cl in cluster:
mang = seeds[cl][-1];
if len(cluster[cl]) > 10:
std[cl] = np.percentile([angledist(xx[2], mang) for xx in cluster[cl]], 90)
clockwise = [xx for xx in cluster[cl] if greaterthanangle(xx[2], mang)];
if std[cl]>20 and len(clockwise)>0 and len(clockwise)<len(cluster[cl]):
seeds1.append(avgpoint(clockwise))
seeds1.append(avgpoint([xx for xx in cluster[cl] if not greaterthanangle(xx[2], mang)]))
seedweight.append(len(clockwise))
seedweight.append(len(cluster[cl]) -len(clockwise))
else:
seeds1.append(seeds[cl]); seedweight.append(len(cluster[cl]))
else:
seeds1.append(seeds[cl]); seedweight.append(len(cluster[cl]))
return seeds1, seedweight
评论列表
文章目录