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 38 of file MinkowskiMetric.h.

Inheritance diagram for CMinkowskiMetric:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 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 bool load_init (FILE *src)
virtual bool save_init (FILE *dest)
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

CMinkowskiMetric::CMinkowskiMetric ( float64_t  k  ) 

constructor

Parameters:
k parameter k

Definition at line 18 of file MinkowskiMetric.cpp.

CMinkowskiMetric::CMinkowskiMetric ( CSimpleFeatures< float64_t > *  l,
CSimpleFeatures< float64_t > *  r,
float64_t  k 
)

constructor

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

Definition at line 23 of file MinkowskiMetric.cpp.

CMinkowskiMetric::~CMinkowskiMetric (  )  [virtual]

Definition at line 30 of file MinkowskiMetric.cpp.


Member Function Documentation

void CMinkowskiMetric::cleanup (  )  [virtual]

cleanup distance

Implements CDistance.

Definition at line 42 of file MinkowskiMetric.cpp.

float64_t CMinkowskiMetric::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 56 of file MinkowskiMetric.cpp.

virtual EDistanceType CMinkowskiMetric::get_distance_type (  )  [virtual]

get distance type we are

Returns:
distance type MINKOWSKI

Implements CDistance.

Definition at line 84 of file MinkowskiMetric.h.

virtual const char* CMinkowskiMetric::get_name (  )  const [virtual]

get name of the distance

Returns:
name Minkowski-Metric

Implements CSGObject.

Definition at line 90 of file MinkowskiMetric.h.

bool CMinkowskiMetric::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 35 of file MinkowskiMetric.cpp.

bool CMinkowskiMetric::load_init ( FILE *  src  )  [virtual]

load init data from file

Parameters:
src file to load from
Returns:
if loading was successful

Implements CDistance.

Definition at line 46 of file MinkowskiMetric.cpp.

bool CMinkowskiMetric::save_init ( FILE *  dest  )  [virtual]

save init data to file

Parameters:
dest file to save to
Returns:
if saving was successful

Implements CDistance.

Definition at line 51 of file MinkowskiMetric.cpp.


Member Data Documentation

parameter k

Definition at line 100 of file MinkowskiMetric.h.


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

SHOGUN Machine Learning Toolbox - Documentation