---
name: "mlpack_kernel_CosineDistance"
section: "3"
platform: "linux"
package: "mlpack-doc"
version: "1.0.10-1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/mlpack_kernel_CosineDistance"
---

# mlpack\_kernel\_CosineDistance(3)

The cosine distance (or cosine similarity).

## NAME

mlpack::kernel::CosineDistance -

The cosine distance (or cosine similarity).

## SYNOPSIS

### Public Member Functions

std::string **ToString** () const \
 *Returns a string representation of this object.*

### Static Public Member Functions

template\<typename VecType \> static double **Evaluate** (const VecType &a, const VecType &b)\
 *Computes the cosine distance between two points.*

## Detailed Description

The cosine distance (or cosine similarity).

It is defined by

.PP and this class assumes the standard L2 inner product.

Definition at line 40 of file cosine\_distance.hpp.

## Member Function Documentation

### template\<typename VecType \> static double mlpack::kernel::CosineDistance::Evaluate (const VecType &a, const VecType &b)` [static]`

Computes the cosine distance between two points.

**Parameters:**

*a* First vector. \
 *b* Second vector.

**Returns:**

d(a, b).

### std::string mlpack::kernel::CosineDistance::ToString () const` [inline]`

Returns a string representation of this object.

Definition at line 56 of file cosine\_distance.hpp.

## Author

Generated automatically by Doxygen for MLPACK from the source code.
