Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::JDDistance< T > Class Template Reference

#include <ProximityMeasure.h>

Inheritance diagram for prapi::JDDistance< T >:

prapi::ProximityMeasure< T > Object List of all members.

Detailed Description

template<class T = double>
class prapi::JDDistance< T >

JDDistance (Jeffrey's Divergence) is a statistical dissimilarity measure.

It is defined as JD = -sumi=1..N(Siln(2*Si/(Mi+Si)) + Miln(2*Mi/(Mi+Si))), where S and M represent the sample and model distributions, respectively. N is the length of the distributions. If the normalization flag is set to true, M is normalized prior to distance calculation.


Public Methods

 JDDistance ()
 Construct a new Jeffrey's Divergence proximity measure.

void setMinValue (double value) throw (InvalidArgumentException&)
 Set the minimum value for a distribution entry that will be encountered.

double getMinValue (void) const
 Get the minimum value that is substituted to zero-valued feature vector entries.

void setNormalized (bool normalize)
 Set the normalized state.

bool isNormalized (void)
 Get the normalize state.

double getProximity (const util::List< T > &sample, const util::List< T > &model, double stopAfter=MAXDOUBLE) const throw (ProximityException&)
 Proximity between two lists.


Constructor & Destructor Documentation

template<class T = double>
prapi::JDDistance< T >::JDDistance   [inline]
 

Construct a new Jeffrey's Divergence proximity measure.

The measure is normalized by default.


Member Function Documentation

template<class T>
double prapi::JDDistance< T >::getProximity const util::List< T > &    sample,
const util::List< T > &    model,
double    stopAfter = MAXDOUBLE
const throw (ProximityException&) [virtual]
 

Proximity between two lists.

Parameters:
sample  the list to be classified
model  the model
stopAfter  A value that can be used in optimizing the performance of a proximity measure. Classifiers may set this value to inform the proximity measure to stop if it notices the proximity will be over a certain value. For example, the kNN classifier sets this value to the kth smallest proximity so far. If a sample is not closer than that, then it makes no sense to inspect it any more.

Implements prapi::ProximityMeasure< T >.

template<class T = double>
void prapi::JDDistance< T >::setMinValue double    value throw (InvalidArgumentException&) [inline]
 

Set the minimum value for a distribution entry that will be encountered.

All zeros in histograms will be replaced with this value in proximity calculations. (Because otherwise a logarithm of zero would be calculated.) Setting this value is particularty important with sparse distributions. If your distribution is a histogram calculated from an matrix, you may want to set this value to 1/(rows*cols).

Exceptions:
InvalidArgumentException  & if value is smaller than or equal to zero.

template<class T = double>
void prapi::JDDistance< T >::setNormalized bool    normalize [inline]
 

Set the normalized state.

If true, then all feature vectors given to this proximity measure are normalized prior to calculating the proximity. If false, then the feature vectors are assumed to be normalized a priori. In the latter case, the computational performance of the measure will be significantly higher. The default value is true.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.