“afinitas propagasi cosine kesamaan python” Kode Jawaban

afinitas propagasi cosine kesamaan 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

afinitas propagasi cosine kesamaan python


# some dummy data
word_vectors = np.random.random((77, 300))

# using eucliden distance
affprop = AffinityPropagation(affinity='euclidean', damping=0.5)
af = affprop.fit(word_vectors)

# using cosine
from sklearn.metrics.pairwise import cosine_distances
word_cosine = cosine_distances(word_vectors)
affprop = AffinityPropagation(affinity='precomputed', damping=0.5)
af = affprop.fit(word_cosine)

Faithful Flatworm

Jawaban yang mirip dengan “afinitas propagasi cosine kesamaan python”

Pertanyaan yang mirip dengan “afinitas propagasi cosine kesamaan python”

Lebih banyak jawaban terkait untuk “afinitas propagasi cosine kesamaan python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya