mlpack  master
Public Member Functions | Static Public Member Functions | List of all members
mlpack::kernel::CosineDistance Class Reference

The cosine distance (or cosine similarity). More...

Public Member Functions

template<typename Archive >
void Serialize (Archive &, const unsigned int)
 Serialize the class (there's nothing to save). More...
 

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...
 

Detailed Description

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.

Definition at line 31 of file cosine_distance.hpp.

Member Function Documentation

template<typename VecTypeA , typename VecTypeB >
static double mlpack::kernel::CosineDistance::Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
)
static

Computes the cosine distance between two points.

Parameters
aFirst vector.
bSecond vector.
Returns
d(a, b).
template<typename Archive >
void mlpack::kernel::CosineDistance::Serialize ( Archive &  ,
const unsigned  int 
)
inline

Serialize the class (there's nothing to save).

Definition at line 46 of file cosine_distance.hpp.


The documentation for this class was generated from the following file: