Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::VQClassifier< I, C > Class Template Reference

#include <VectorQuantizer.h>

Inheritance diagram for prapi::VQClassifier< I, C >:

prapi::VectorQuantizer prapi::Classifier< double, I, C > Object EventSource< ClassificationEvent< double, I, C > > Object prapi::OLVQ1< I, C > List of all members.

Detailed Description

template<class I = std::string, class C = int>
class prapi::VQClassifier< I, C >

VQClassifier is a vector quantizer that uses a code book and works as a classifier at the same time.


Public Methods

 VQClassifier (ProximityMeasure< double > *measure, int classCount=1)
 Create a new VectorQuantizer.

 VQClassifier (ProximityMeasure< double > &measure, int classCount=1)
 Create a new VectorQuantizer.

virtual int getBinIndex (const util::List< double > &vector) const throw (ClassificationException&)
 Get the scalar correspondent (codebook bin index) for a multi-dimensional vector.

int getBinIndex (const Sample< double, I, C > &sample) const throw (ClassificationException&)
 Get the scalar correspondent (codebook bin index) for a multi-dimensional vector.

int getMaxIndex () const
 Returns the length of the code book minus one.

virtual int getClassification (Sample< double, I, C > &sample) throw (ClassificationException&)
 Get the classification given to the closest code book vector.

util::List< Sample< double,
I, C > > 
getCodeBook () const
 Get a copy of the current code book.

util::List< Sample< double,
I, C > > & 
codeBook ()
 Get a reference to the current code book.

const util::List< Sample<
double, I, C > > & 
codeBook () const
 Get a const reference to the current code book.

void setCodeBook (util::List< Sample< double, I, C > > codeBook)
 Set the code book.

void setBinIndexMode (bool binIndexMode)
 Change classification mode.

bool getBinIndexMode () const
 Get the current classification mode.


Protected Attributes

bool _bBinIndexMode
util::List< Sample< double,
I, C > > 
_lstCodeBook


Constructor & Destructor Documentation

template<class I, class C>
prapi::VQClassifier< I, C >::VQClassifier ProximityMeasure< double > *    measure,
int    classCount = 1
 

Create a new VectorQuantizer.

There are no training samples as the internal code book is used as such.

Parameters:
measure  the proximity measure to be used in measuring distances between vectors (autorelease).
classCount  the number of classes in the data

template<class I, class C>
prapi::VQClassifier< I, C >::VQClassifier ProximityMeasure< double > &    measure,
int    classCount = 1
 

Create a new VectorQuantizer.

There are no training samples as the internal code book is used as such.

Parameters:
measure  the proximity measure to be used in measuring distances between vectors.
classCount  the number of classes in the data


Member Function Documentation

template<class I = std::string, class C = int>
int prapi::VQClassifier< I, C >::getBinIndex const Sample< double, I, C > &    sample const throw (ClassificationException&) [inline]
 

Get the scalar correspondent (codebook bin index) for a multi-dimensional vector.

Parameters:
sample  the sample whose feature vector is to be quantized
Returns:
the index of the closest vector in the code book

template<class I, class C>
int prapi::VQClassifier< I, C >::getBinIndex const util::List< double > &    vector const throw (ClassificationException&) [virtual]
 

Get the scalar correspondent (codebook bin index) for a multi-dimensional vector.

Parameters:
vec  a multi-dimensional vector to be quantized
Returns:
the index of the closest vector in the code book

Implements prapi::VectorQuantizer.

template<class I = std::string, class C = int>
void prapi::VQClassifier< I, C >::setBinIndexMode bool    binIndexMode [inline]
 

Change classification mode.

VQClassifier can work in two different modes. The default (intuitive) way is to assign a classification according to the trueClass field of the best matching code vector. In "bin index" mode, classification is assigned according to the index of the best matching code vector. In this mode, each code vector represents a "class". The first code vector has the index 0 and so on.


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.