Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::ProximityMeasure< T > Class Template Reference

#include <ProximityMeasure.h>

Inheritance diagram for prapi::ProximityMeasure< T >:

Object prapi::Cumlog< T > prapi::EuclideanDistance< T > prapi::HistogramIntersection< T > prapi::JDDistance< T > prapi::ProximityAdder< T > prapi::ProximityModifier< operation, T > prapi::ProximityMultiplier< T > prapi::SquaredEuclidean< T > List of all members.

Detailed Description

template<class T>
class prapi::ProximityMeasure< T >

ProximityMeasure is a general representation of a proximity measure between samples, sample sets (clusters) or between a sample and a cluster.

It is used by classifiers and the clustering algorighms provided by the clustering library. In these contextes, "proximity" is always taken to mean "dissimilarity". That is, minimizing the proximity measure means finding closest sample or cluster. If you are using similarity measure, try to find a reasonable inversion for it.


Public Methods

 ProximityMeasure (bool representatives=true, bool symmetric=true)
 Create a new ProximityMeasure that either uses or does not use cluster representatives and either is or is not symmetric.

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

template<class I, class C> double getProximity (const Sample< T, I, C > &sample, const Sample< T, I, C > &model, double stopAfter=MAXDOUBLE) const throw (ProximityException&)
 Proximity between two samples.

template<class I, class C> double getProximity (const Sample< T, I, C > &sample, const Cluster< T, I, C > &sampleSet, double stopAfter=MAXDOUBLE) const throw (ProximityException&)
 Proximity between sample and a set.

template<class I, class C> double getProximity (const Cluster< T, I, C > &sampleSet1, const Cluster< T, I, C > &sampleSet2, double stopAfter=MAXDOUBLE) const throw (ProximityException&)
 Proximity between two sets.

bool usesRepresentatives (void) const
 Check whether this measure is using representatives in calculating proximities between sets or in calculating the proximity between a sample and a set.

void setUseRepresentatives (bool use)
 Set the use "representatives flag".

bool isSymmetric (void)
 See whether this measure is symmetric.


Protected Attributes

bool _bUseRepresentatives
 A flag that indicates whether this measure uses cluster representatives.

bool _bSymmetric
 A flag that indicates whether this measure is a symmetric measure, i.e.


Member Function Documentation

template<class T>
template<class I, class C>
double prapi::ProximityMeasure< T >::getProximity const Cluster< T, I, C > &    sampleSet1,
const Cluster< T, I, C > &    sampleSet2,
double    stopAfter = MAXDOUBLE
const throw (ProximityException&)
 

Proximity between two sets.

If cluster representatives are not used, this implementation returns the minimum proximity between any two samples in the given sets by using the getProximity method. Otherwise the proximity between cluster representatives is returned.

If representatives are not used, the complexity of this procedure is O(NM), where N and M are the sample counts in each cluster

Parameters:
sampleSet1  cluster one
sampleSet1  cluster two
stopAfter  maximum allowable proximity
See also:
getProximity(const util::List&, const util::List&, double)

template<class T>
template<class I, class C>
double prapi::ProximityMeasure< T >::getProximity const Sample< T, I, C > &    sample,
const Cluster< T, I, C > &    sampleSet,
double    stopAfter = MAXDOUBLE
const throw (ProximityException&)
 

Proximity between sample and a set.

If cluster representatives are set off, this implementation returns the minimum proximity between the given sample and any sample in the given cluster by using the getProximity method. Otherwise the proximity between the sample and the cluster's representative is returned.

If representatives are not used, the complexity of this procedure is O(N), where N is the number of samples in a cluster.

Parameters:
sample  the sample to be inspected
sampleSet  a set of samples that form a cluster
stopAfter  maximum allowable proximity
See also:
getProximity(const util::List&, const util::List&, double)

template<class T>
template<class I, class C>
double prapi::ProximityMeasure< T >::getProximity const Sample< T, I, C > &    sample,
const Sample< T, I, C > &    model,
double    stopAfter = MAXDOUBLE
const throw (ProximityException&)
 

Proximity between two samples.

Parameters:
sample  the sample to be classified
model  the model
stopAfter  maximum allowable proximity
See also:
getProximity(const util::List&, const util::List&, double)

template<class T>
virtual double prapi::ProximityMeasure< T >::getProximity const util::List< T > &    sample,
const util::List< T > &    model,
double    stopAfter = MAXDOUBLE
const throw (ProximityException&) [pure 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.

Implemented in JHDistance, MMDistance, prapi::ProximityModifier< operation, T >, prapi::ProximityAdder< T >, prapi::ProximityMultiplier< T >, prapi::EuclideanDistance< T >, prapi::SquaredEuclidean< T >, prapi::Cumlog< T >, prapi::JDDistance< T >, and prapi::HistogramIntersection< T >.

template<class T>
void prapi::ProximityMeasure< T >::setUseRepresentatives bool    use [inline]
 

Set the use "representatives flag".

The default value is true. See getProximity() for more info.


Member Data Documentation

template<class T>
bool prapi::ProximityMeasure< T >::_bSymmetric [protected]
 

A flag that indicates whether this measure is a symmetric measure, i.e.

P(a,b) = P(b,a), where P(x,y) is the proximity between samples x and y.


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.