cos_similarity: Compute the cosine similarity between two objects A and B

Description Usage Arguments Value Author(s) Examples

View source: R/anime_functions.R

Description

Compute the cosine similarity between two objects A and B

Usage

1

Arguments

A

first object

B

second object

Value

Return the cosine similarity value

Author(s)

Marie Bellier, Massimo Finini, Meri Likoska, Vania Rodrigues Telo Ramos, Xavier Renger

Examples

1
2
3
4
5
6
7
8
#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,])

ptds2021/project--G5 documentation built on Dec. 22, 2021, 9:59 a.m.