mlpack  master

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

◆ Evaluate()

static double Evaluate ( const VecTypeA &  a,
const VecTypeB &  b 
)
static

Computes the cosine distance between two points.

Parameters
aFirst vector.
bSecond vector.
Returns
d(a, b).

◆ serialize()

void 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: