SingleStumpLearner Class Reference

A single threshold decision stump learner. More...

#include <SingleStumpLearner.h>

Inheritance diagram for SingleStumpLearner:

StumpLearner BaseLearner List of all members.

Public Member Functions

virtual BaseLearnercreate ()
 Returns itself as object.
virtual void run (InputData *pData)
 Run the learner to build the classifier on the given data.
virtual void save (ofstream &outputStream, const int numTabs=0)
 Save the current object information needed for classification, that is the single threshold.
virtual void load (nor_utils::StreamTokenizer &st)
 Load the xml file that contains the serialized information needed for the classification and that belongs to this class.

Private Member Functions

virtual char phi (double val, int classIdx)
 A discriminative function.
virtual void findThreshold (InputData *pData, const int columnIdx, double &threshold, vector< sRates > &mu, vector< char > &v)
 Find the threshold for column columnIndex.

Private Attributes

double _threshold
 the single threshold of the decision stump

Detailed Description

A single threshold decision stump learner.

There is ONE and ONE ONLY threshold here.

Definition at line 50 of file SingleStumpLearner.h.


Member Function Documentation

virtual BaseLearner* create  )  [inline, virtual]
 

Returns itself as object.

Remarks:
It uses the trick described in http://www.parashift.com/c++-faq-lite/serialization.html#faq-36.8 for the auto-registering classes.
Date:
14/11/2005

Implements BaseLearner.

Definition at line 60 of file SingleStumpLearner.h.

void findThreshold InputData pData,
const int  columnIdx,
double &  threshold,
vector< sRates > &  mu,
vector< char > &  v
[private, virtual]
 

Find the threshold for column columnIndex.

Parameters:
pData The pointer to the data
columnIdx The index of the data column
threshold The threshold to update
mu The The class-wise rates to update
v The alignment vector to update
See also:
StumpLearner::sMu

run

Date:
11/11/2005

Definition at line 103 of file SingleStumpLearner.cpp.

References StumpLearner::_bestErrors, StumpLearner::_halfWeightsPerClass, StumpLearner::_leftErrors, StumpLearner::_rightErrors, BaseLearner::_smallVal, StumpLearner::_weightsPerClass, InputData::getClass(), ClassMappings::getNumClasses(), and InputData::getWeight().

void load nor_utils::StreamTokenizer st  )  [virtual]
 

Load the xml file that contains the serialized information needed for the classification and that belongs to this class.

Parameters:
st The stream tokenizer that returns tags and values as tokens
See also:
save()
Date:
13/11/2005

Reimplemented from StumpLearner.

Definition at line 273 of file SingleStumpLearner.cpp.

References SingleStumpLearner::_threshold, and StumpLearner::load().

char phi double  val,
int  classIdx
[private, virtual]
 

A discriminative function.

Remarks:
Positive or negative do NOT refer to positive or negative classification. This function is equivalent to the phi function in my thesis.
Parameters:
val The value to discriminate
classIdx The index of the class
Returns:
+1 if val is on one side of the border for classIdx and -1 otherwise
Date:
11/11/2005
See also:
classify

Implements StumpLearner.

Definition at line 93 of file SingleStumpLearner.cpp.

References SingleStumpLearner::_threshold.

void run InputData pData  )  [virtual]
 

Run the learner to build the classifier on the given data.

Parameters:
pData The pointer to the data
See also:
BaseLearner::run
Date:
11/11/2005

Implements BaseLearner.

Definition at line 40 of file SingleStumpLearner.cpp.

References ClassMappings::getNumClasses().

void save ofstream &  outputStream,
const int  numTabs = 0
[virtual]
 

Save the current object information needed for classification, that is the single threshold.

Parameters:
outputStream The stream where the data will be saved
numTabs The number of tabs before the tag. Useful for indentation
Remarks:
To fully save the object it is very important to call also the super-class method.
See also:
StumpLearner::save()
Date:
13/11/2005

Reimplemented from StumpLearner.

Definition at line 262 of file SingleStumpLearner.cpp.

References SingleStumpLearner::_threshold, StumpLearner::save(), and Serialization::standardTag().


The documentation for this class was generated from the following files:
Generated on Mon Nov 28 21:43:48 2005 for MultiBoost by  doxygen 1.4.5