dgs.models.metric.metric.CosineDistanceMetric

class dgs.models.metric.metric.CosineDistanceMetric(*args: Any, **kwargs: Any)[source]

Class to compute the cosine distance between two matrices.

Notes

The cosine distance is the complement of the cosine similarity in positive space:

\[ \begin{align}\begin{aligned}\text{cosine similarity} = S_C(A,B) = \frac{\mathbf{A} \cdot \mathbf{B}}{\|\mathbf{A}\| \|\mathbf{B}\|}\\\text{cosine distance} = 1 - S_C(A,B)\end{aligned}\end{align} \]
__init__(*args, **kwargs) None[source]

Methods

forward(input1, input2)