cos_similarity.Rd
Compute the cosine similarity between two objects A and B
cos_similarity(A, B)
A | first object |
---|---|
B | second object |
Return the cosine similarity value
Marie Bellier, Massimo Finini, Meri Likoska, Vania Rodrigues Telo Ramos, Xavier Renger
#setting seed to always have the same results set.seed(10) #creating a matrix with random numbers in between 1 to 10 from a uniform distribution x <- matrix(runif(10)*10, ncol=5, nrow=4, byrow=FALSE) #computing the cosine similarity between cos_similarity(x[1,], x[3,]) #> [1] 0.8406276