Cosine distance¶
The Cosine distance is a measure of distance between two non-zero vectors of an inner product space.
Operation |
Computational methods |
|
Mathematical formulation¶
Computing¶
Given a set \(U\) of \(n\) feature vectors \(u_1 = (u_{11}, \ldots, u_{1k}), \ldots, u_n = (u_{n1}, \ldots, u_{nk})\) of dimension \(k\) and a set \(V\) of \(m\) feature vectors \(v_1 = (v_{11}, \ldots, v_{1k}), \ldots, v_m = (v_{m1}, \ldots, v_{mk})\) of dimension \(k\), the problem is to compute the Cosine distance \(D_{cos}(u_i, v_j)\) for any pair of input vectors:
where \(\quad 1 \leq i \leq n, \quad 1 \leq j \leq m\).
Computation method: dense¶
The method defines Cosine distance metric, which is used in other algorithms for the distance computation. There is no separate computation mode to compute the distance manually.
Programming Interface¶
Refer to API Reference: Cosine distance.