cosine_simi: Cosine similarity between vectors and/or matrices.

View source: R/dist_matrix.R

cosine_simiR Documentation

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)

Arguments

x

Numeric vector or matrix

y

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

Value

Symmetric numeric similarity matrix


ThomasChln/opticskxi documentation built on April 12, 2025, 5:43 a.m.