📜  余弦相似度 python numpy - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:37.150000             🧑  作者: Mango

代码示例2
from numpy import dot
from numpy.linalg import norm

def cosine_similarity(list_1, list_2):
  cos_sim = dot(list_1, list_2) / (norm(list_1) * norm(list_2))
  return cos_sim