Pergunta

I am using below code to compute cosine similarity between the 2 vectors. It returns a matrix instead of a single value 0.8660254.

[[ 1. 0.8660254]

[ 0.8660254 1. ]]

from sklearn.metrics.pairwise import cosine_similarity
vec1 = [1,1,0,1,1]
vec2 = [0,1,0,1,1]
print(cosine_similarity([vec1, vec2]))

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
scroll top