Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::NNClassifier< T, I, C > Class Template Reference

#include <Classifier.h>

Inheritance diagram for prapi::NNClassifier< T, I, C >:

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

Detailed Description

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

An implementation of the nearest neighbor classifier.

Each unknown sample is classified according to the class of the sample that has the smallest proximity measure between it.


Public Methods

 NNClassifier (util::List< Sample< T, I, C > > *trainingSamples, ProximityMeasure< T > *measure, int classCount)
 Create a new NN classifier with the given training samples, proximity measure and class count.

 NNClassifier (util::List< Sample< T, I, C > > &trainingSamples, ProximityMeasure< T > *measure, int classCount)
 Create a new NN classifier with the given training samples, proximity measure and class count.

 NNClassifier (util::List< Sample< T, I, C > > &trainingSamples, ProximityMeasure< T > &measure, int classCount)
 Create a new NN classifier with the given training samples, proximity measure and class count.

getClassification (Sample< T, I, C > &sample) throw (ClassificationException&)
 Get the classification for a single sample.


Constructor & Destructor Documentation

template<class T, class I = std::string, class C = int>
prapi::NNClassifier< T, I, C >::NNClassifier util::List< Sample< T, I, C > > *    trainingSamples,
ProximityMeasure< T > *    measure,
int    classCount
[inline]
 

Create a new NN classifier with the given training samples, proximity measure and class count.

(Autorelease measure.)

template<class T, class I = std::string, class C = int>
prapi::NNClassifier< T, I, C >::NNClassifier util::List< Sample< T, I, C > > &    trainingSamples,
ProximityMeasure< T > *    measure,
int    classCount
[inline]
 

Create a new NN classifier with the given training samples, proximity measure and class count.

(Autorelease measure.)


Member Function Documentation

template<class T, class I, class C>
C prapi::NNClassifier< T, I, C >::getClassification Sample< T, I, C > &    sample throw (ClassificationException&) [virtual]
 

Get the classification for a single sample.

This method is used by holdOut and leaveOneOut to classify each sample. Subclasses must override this method.

Parameters:
sample  the sample to be classified
Returns:
the classification. Simple classfiers (like NN or kNN) use integers. More sophisticated ones may use any classification type.
See also:
Sample for more information.

Implements prapi::Classifier< T, I, C >.


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.