Find cosine similarity between two arrays

后端 未结 6 1472
忘掉有多难
忘掉有多难 2020-11-27 13:28

I\'m wondering if there is a built in function in R that can find the cosine similarity (or cosine distance) between two arrays?

Currently, I implemented my own func

6条回答
  •  北海茫月
    2020-11-27 13:55

    It looks like a few options are already available, but I just stumbled across an idiomatic solution I like so I thought I'd add it to the list.

    install.packages('proxy') # Let's be honest, you've never heard of this before.
    library('proxy') # Library of similarity/dissimilarity measures for 'dist()'
    dist(m, method="cosine")
    

提交回复
热议问题