def find_number_of_sources(cosine_distance):
cos_dist = np.resize(cosine_distance, new_shape = (len(cosine_distance), len(cosine_distance)))
ap = AP(affinity = 'precomputed').fit(cos_dist)
counter = Counter(ap.labels_).most_common()
source = 0
for i in xrange(len(counter)):
if counter[i][1] == counter[0][1]:
source += 1
return source
评论列表
文章目录