Learn R Programming

opticskxi (version 1.2.0)

cosine_simi: Cosine similarity between vectors and/or matrices.

Description

Inputs will be L2 normalized, then matrix multiplied (y is transposed). If second input is missing, first input will be recycled, which enables to efficiently compute cosine similarities between the rows of a rectangular matrix.

Usage

cosine_simi(x, y)

Value

Symmetric numeric similarity matrix

Arguments

x

Numeric vector or matrix

y

Numeric vector or matrix. If missing, copied from parameter x.