Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

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

#include <TreeClassifier.h>

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

EventSource< T > Object List of all members.

Detailed Description

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

TreeClassifier is made to help Building a treeclassifier.

It Classifies root's given with function addChild. Every root have to give a Classifier which contains the information how the specified root should be classified. Remember that the template parameter T is spesified for List<T>, that means you have to give a list of Features for TreeClassifier.


Public Methods

 TreeClassifier (Classifier< List< T >, I, C > *classifier, IntegerList classes)
 Create a new TreeClassifier node.

virtual ~TreeClassifier ()
 NOTE destructor deletes all the children when it is deleted.

void addChild (TreeClassifier< T, I, C > *child, int rootIndex) throw (TreeClassificationException&)
 AddChild funtion adds the childer for TreeClassifier.

TreeClassifier< T, I, C > * getChild (int rootIndex) throw (TreeClassificationException&)
 Get the child node of this TreeClassifier from rootNumber given.

void holdOut (List< Sample< List< T >, I, C > > &lst) throw (TreeClassificationException&)
 Perform a holdout test using the given samples as testing data for all of the roots.

void leaveOneOut (void) throw (TreeClassificationException&)
 Perform a leave-one-out test on the training data for all of the roots.

void collectClassification (List< Sample< List< T >, I, C > > &resultList)
 Funktion which collects the classification from samples.

void print (ostream &out, List< string > &lst, int depth=0)
 Funktion which prints the TreeCalssifier.

void buildTreeClassifier (List< Sample< List< T >, I, C > > &trainingSamples, int classCount, double limitValue, int numberOfDividingTests=10, double changeOfLimitValue=0.01) throw (TreeClassificationException&)
 Function buildTreeClassifier.

void setTrainingSamples (List< Sample< List< T >, I, C > > &sampleList)
 Set the training samples for TreeClassifier.

List< Sample< List< T >, I,
C > > & 
getTrainingSamples ()
 Get the Training samples from TreeClassifier.


Constructor & Destructor Documentation

template<class T, class I, class C>
prapi::TreeClassifier< T, I, C >::TreeClassifier Classifier< List< T >, I, C > *    classifier,
IntegerList    classes
 

Create a new TreeClassifier node.

NOTE you must do every child TreeClassifier with new operator therefor that the deleting of those pointers will be done right.

Parameters:
classifier  is the Classifier which will be used in tree classification.
classes  is the list which includes the information about used classes.


Member Function Documentation

template<class T, class I, class C>
void prapi::TreeClassifier< T, I, C >::addChild TreeClassifier< T, I, C > *    child,
int    rootIndex
throw (TreeClassificationException&)
 

AddChild funtion adds the childer for TreeClassifier.

Remember that the first root index is zero.

Parameters:
child  new TreeClassifier which will be used in classifing child.
rootIndex  is the index of the root wanted to classify again.

template<class T, class I, class C>
void prapi::TreeClassifier< T, I, C >::buildTreeClassifier List< Sample< List< T >, I, C > > &    trainingSamples,
int    classCount,
double    limitValue,
int    numberOfDividingTests = 10,
double    changeOfLimitValue = 0.01
throw (TreeClassificationException&)
 

Function buildTreeClassifier.

Parameters:
trainingSamples  samples that are used at training of the tree.
classifier  which is used in building. Remember: You should give classifier which DO NOT have any training samples.
limitValue  the value which is used to determine if some class is so good that there is no use to divide it anymore.
numberOfDividingTests  tell how many compinations are used in every level (max amount).
changeOfLimitValue  tell how much the limitValue will be rised if it's too low to build a tree.

template<class T, class I, class C>
void prapi::TreeClassifier< T, I, C >::collectClassification List< Sample< List< T >, I, C > > &    resultList
 

Funktion which collects the classification from samples.

Parameters:
resultList  sample list where wanted to add result samples.

template<class T, class I, class C>
TreeClassifier< T, I, C > * prapi::TreeClassifier< T, I, C >::getChild int    rootIndex throw (TreeClassificationException&)
 

Get the child node of this TreeClassifier from rootNumber given.

Parameters:
rootIndex  the index of child node.

template<class T, class I, class C>
void prapi::TreeClassifier< T, I, C >::holdOut List< Sample< List< T >, I, C > > &    lst throw (TreeClassificationException&)
 

Perform a holdout test using the given samples as testing data for all of the roots.

Parameters:
lst  testing samples

template<class T, class I, class C>
void prapi::TreeClassifier< T, I, C >::print ostream &    out,
List< string > &    lst,
int    depth = 0
 

Funktion which prints the TreeCalssifier.

Parameters:
out  the output stream
lst  list of names for features.


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.