Public Member Functions | Protected Member Functions | Protected Attributes

CMinkowskiMetric Class Reference


Detailed Description

class MinkowskiMetric

The Minkowski metric is one general class of metrics for a $\displaystyle R^{n}$ feature space also referred as the $\displaystyle L_{k} $ norm.

\[ \displaystyle d(\bf{x},\bf{x'}) = (\sum_{i=1}^{n} |\bf{x_{i}}-\bf{x'_{i}}|^{k})^{\frac{1}{k}} \quad x,x' \in R^{n} \]

special cases:

  1. $\displaystyle L_{1} $ norm: Manhattan distance
    See also:
    CManhattanMetric
  2. $\displaystyle L_{2} $ norm: Euclidean distance
    See also:
    CEuclidianDistance
    Note that the Minkowski distance tends to the Chebyshew distance for increasing $k$.
See also:
Wikipedia: Distance

Definition at line 40 of file MinkowskiMetric.h.

Inheritance diagram for CMinkowskiMetric:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CMinkowskiMetric ()
 CMinkowskiMetric (float64_t k)
 CMinkowskiMetric (CSimpleFeatures< float64_t > *l, CSimpleFeatures< float64_t > *r, float64_t k)
virtual ~CMinkowskiMetric ()
virtual bool init (CFeatures *l, CFeatures *r)
virtual void cleanup ()
virtual EDistanceType get_distance_type ()
virtual const char * get_name () const

Protected Member Functions

virtual float64_t compute (int32_t idx_a, int32_t idx_b)

Protected Attributes

float64_t k

Constructor & Destructor Documentation

default constructor

Definition at line 23 of file MinkowskiMetric.cpp.

constructor

Parameters:
k parameter k

Definition at line 28 of file MinkowskiMetric.cpp.

constructor

Parameters:
l features of left-hand side
r features of right-hand side
k parameter k

Definition at line 35 of file MinkowskiMetric.cpp.

~CMinkowskiMetric (  )  [virtual]

Definition at line 44 of file MinkowskiMetric.cpp.


Member Function Documentation

void cleanup (  )  [virtual]

cleanup distance

Implements CSimpleDistance< float64_t >.

Definition at line 54 of file MinkowskiMetric.cpp.

float64_t compute ( int32_t  idx_a,
int32_t  idx_b 
) [protected, virtual]

compute distance for features a and b idx_{a,b} denote the index of the feature vectors in the corresponding feature object

Implements CDistance.

Definition at line 58 of file MinkowskiMetric.cpp.

virtual EDistanceType get_distance_type (  )  [virtual]

get distance type we are

Returns:
distance type MINKOWSKI

Implements CSimpleDistance< float64_t >.

Definition at line 75 of file MinkowskiMetric.h.

virtual const char* get_name (  )  const [virtual]

get name of the distance

Returns:
name Minkowski-Metric

Reimplemented from CSimpleDistance< float64_t >.

Definition at line 81 of file MinkowskiMetric.h.

bool init ( CFeatures l,
CFeatures r 
) [virtual]

constructor

Parameters:
l features of left-hand side
r features of right-hand side

Reimplemented from CSimpleDistance< float64_t >.

Definition at line 49 of file MinkowskiMetric.cpp.


Member Data Documentation

float64_t k [protected]

parameter k

Definition at line 94 of file MinkowskiMetric.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation