Answers for "affinity propagation cosine similarity python"

0

affinity propagation cosine similarity 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)
Posted by: Guest on July-23-2021

Code answers related to "affinity propagation cosine similarity python"

Python Answers by Framework

Browse Popular Code Answers by Language