Propagação de afinidade Python similaridade Python
# credit to Stack Overflow user in the source link
import numpy as np
from sklearn.metrics.pairwise import cosine_distances
# some dummy data
word_vectors = np.random.random((77, 300))
word_cosine = cosine_distances(word_vectors)
affprop = AffinityPropagation(affinity = 'precomputed', damping = 0.5)
af = affprop.fit(word_cosine)
wolf-like_hunter