mlpack
|
The cosine distance (or cosine similarity). More...
#include <cosine_distance.hpp>
Public Member Functions | |
template<typename Archive > | |
void | serialize (Archive &, const uint32_t) |
Serialize the class (there's nothing to save). | |
Static Public Member Functions | |
template<typename VecTypeA , typename VecTypeB > | |
static double | Evaluate (const VecTypeA &a, const VecTypeB &b) |
Computes the cosine distance between two points. More... | |
The cosine distance (or cosine similarity).
It is defined by
\[ d(a, b) = \frac{a^T b}{|| a || || b ||} \]
and this class assumes the standard L2 inner product.
|
static |
Computes the cosine distance between two points.
a | First vector. |
b | Second vector. |