문제

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]))

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 datascience.stackexchange
scroll top