Machine learning algorithms in C++
Static Public Member Functions
Metrics Class Reference

Distance metrics. More...

#include <Metrics.hpp>

Collaboration diagram for Metrics:

Static Public Member Functions

static MatrixD minkowski (MatrixD m, double p, bool root=true)
 Calculates the Minkowski distances between elements in a matrix. More...
 
static MatrixD chebyshev (MatrixD a)
 Calculates the Chebyshev distances between elements in a matrix. More...
 
static MatrixD euclidean (MatrixD m, bool root=true)
 Calculates the Euclidean distances between elements in a matrix. More...
 
static MatrixD manhattan (MatrixD m, bool root=true)
 Calculates the Manhattan distances between elements in a matrix. More...
 
static MatrixD minkowski (MatrixD a, MatrixD b, double p, bool root=true)
 Calculates the Minkowski distances between elements in two matrices. More...
 
static MatrixD chebyshev (MatrixD a, MatrixD b)
 Calculates the Chebyshev distances between elements in two matrices. More...
 
static MatrixD euclidean (MatrixD a, MatrixD b, bool root=true)
 Calculates the Euclidean distances between elements in two matrices. More...
 
static MatrixD manhattan (MatrixD a, MatrixD b, bool root=true)
 Calculates the Manhattan distances between elements in two matrices. More...
 

Detailed Description

Distance metrics.

Definition at line 13 of file Metrics.hpp.

Member Function Documentation

◆ chebyshev() [1/2]

static MatrixD Metrics::chebyshev ( MatrixD  a)
inlinestatic

Calculates the Chebyshev distances between elements in a matrix.

Elements must be located in the matrix rows

Parameters
amatrix of elements
Returns
a matrix containing, in its n x m position, the distance between the nth and mth elements in the matrix

Definition at line 41 of file Metrics.hpp.

◆ chebyshev() [2/2]

static MatrixD Metrics::chebyshev ( MatrixD  a,
MatrixD  b 
)
inlinestatic

Calculates the Chebyshev distances between elements in two matrices.

Elements must be located in the matrices rows and both matrices must have the same number of features (columns)

Parameters
afirst matrix
bsecond matrix
Returns
a matrix containing, in its n x m position, the distance between the nth element in the first matrix and the mth element in the second matrix

Definition at line 105 of file Metrics.hpp.

◆ euclidean() [1/2]

static MatrixD Metrics::euclidean ( MatrixD  m,
bool  root = true 
)
inlinestatic

Calculates the Euclidean distances between elements in a matrix.

Elements must be located in the matrix rows

Parameters
mmatrix of elements
rootwhether to take the root of the distance. Default is False for the expected behavior
Returns
a matrix containing, in its n x m position, the distance between the nth and mth elements in the matrix

Definition at line 61 of file Metrics.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ euclidean() [2/2]

static MatrixD Metrics::euclidean ( MatrixD  a,
MatrixD  b,
bool  root = true 
)
inlinestatic

Calculates the Euclidean distances between elements in two matrices.

Elements must be located in the matrices rows and both matrices must have the same number of features (columns)

Parameters
afirst matrix
bsecond matrix
rootwhether to take the root of the distance. Default is False for the expected behavior
Returns
a matrix containing, in its n x m position, the distance between the nth element in the first matrix and the mth element in the second matrix

Definition at line 129 of file Metrics.hpp.

Here is the call graph for this function:

◆ manhattan() [1/2]

static MatrixD Metrics::manhattan ( MatrixD  m,
bool  root = true 
)
inlinestatic

Calculates the Manhattan distances between elements in a matrix.

Elements must be located in the matrix rows

Parameters
mmatrix of elements
rootwhether to take the root of the distance. Default is False for the expected behavior
Returns
a matrix containing, in its n x m position, the distance between the nth and mth elements in the matrix

Definition at line 69 of file Metrics.hpp.

Here is the call graph for this function:

◆ manhattan() [2/2]

static MatrixD Metrics::manhattan ( MatrixD  a,
MatrixD  b,
bool  root = true 
)
inlinestatic

Calculates the Manhattan distances between elements in two matrices.

Elements must be located in the matrices rows and both matrices must have the same number of features (columns)

Parameters
afirst matrix
bsecond matrix
rootwhether to take the root of the distance. Default is False for the expected behavior
Returns
a matrix containing, in its n x m position, the distance between the nth element in the first matrix and the mth element in the second matrix

Definition at line 138 of file Metrics.hpp.

Here is the call graph for this function:

◆ minkowski() [1/2]

static MatrixD Metrics::minkowski ( MatrixD  m,
double  p,
bool  root = true 
)
inlinestatic

Calculates the Minkowski distances between elements in a matrix.

Elements must be located in the matrix rows

Parameters
mmatrix of elements
pthe power to be used by the metric
rootwhether to take the root of the distance. Default is False for the expected behavior
Returns
a matrix containing, in its n x m position, the distance between the nth and mth elements in the matrix

Definition at line 22 of file Metrics.hpp.

Here is the caller graph for this function:

◆ minkowski() [2/2]

static MatrixD Metrics::minkowski ( MatrixD  a,
MatrixD  b,
double  p,
bool  root = true 
)
inlinestatic

Calculates the Minkowski distances between elements in two matrices.

Elements must be located in the matrices rows and both matrices must have the same number of features (columns)

Parameters
afirst matrix
bsecond matrix
pthe power to be used by the metric
rootwhether to take the root of the distance. Default is False for the expected behavior
Returns
a matrix containing, in its n x m position, the distance between the nth element in the first matrix and the mth element in the second matrix

Definition at line 79 of file Metrics.hpp.


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