Module cosine

Source
Expand description

Cosine distance metric.

Cosine distance = $1 - \text{cosine_similarity}(a, b)$

Range: [0.0, 2.0] where 0.0 = identical direction, 1.0 = orthogonal, 2.0 = opposite.

Structsยง

CosineDistance
Cosine distance: $d(a, b) = 1 - \frac{a \cdot b}{|a| \cdot |b|}$.