OutputInfo Class Reference

Format and output step-by-step information. More...

#include <OutputInfo.h>

List of all members.

Public Member Functions

 OutputInfo (const string &outputInfoFile)
 The constructor.
void outputIteration (const int t)
 Just output the iteration number.
void outputError (InputData *pData, BaseLearner *pWeakHypothesis)
 Output the error of the given data.
void outputMargins (InputData *pData, BaseLearner *pWeakHypothesis)
 Output the minimum margin the sum of below zero margins.
void outputEdge (InputData *pData, BaseLearner *pWeakHypothesis)
 Output the edge.
void endLine ()
 End of line in the file stream.

Protected Types

typedef vector< vector< double > > table
 A table representing the votes for each example.

Protected Attributes

ofstream _outStream
 The output stream.
map< InputData *, table_gTableMap
 Maps the data to its g(x) table.
map< InputData *, table_margins
 Maps the data to the margins table.
map< InputData *, double > _alphaSums
 Maps the data to the sum of the alpha.


Detailed Description

Format and output step-by-step information.

With this class it is possible to output and update the error rates, margins and the edge. These function must be called at each iteration with the newly found weak hypothesis, but before the update of the weights.

Warning:
Don't forget to begin the list of information printed with outputIteration(), and close it with a call to endLine()!
Date:
16/11/2005

Definition at line 58 of file OutputInfo.h.


Member Typedef Documentation

typedef vector< vector<double> > table [protected]
 

A table representing the votes for each example.

Example:

   Ex_1:  Class 0, Class 1, Class 2, .. , Class k
   Ex_2:  Class 0, Class 1, Class 2, .. , Class k
   ..
   Ex_n:  Class 0, Class 1, Class 2, .. , Class k 
Date:
16/11/2005

Definition at line 156 of file OutputInfo.h.


Constructor & Destructor Documentation

OutputInfo const string &  outputInfoFile  ) 
 

The constructor.

Create the object and open the output file.

Parameters:
outputInfoFile The name of the file which will be updated with the data.
Date:
14/11/2005

Definition at line 31 of file OutputInfo.cpp.

References OutputInfo::_outStream.


Member Function Documentation

void endLine  )  [inline]
 

End of line in the file stream.

Call it when all the needed information has been outputted.

Date:
16/11/2005

Definition at line 142 of file OutputInfo.h.

References OutputInfo::_outStream.

Referenced by Classifier::computeResults().

void outputEdge InputData pData,
BaseLearner pWeakHypothesis
 

Output the edge.

It is the measure of the accuracy of the current weak hypothesis relative to random guessing, and is defined as

\[ \gamma = \sum_{i=1}^n \sum_{\ell=1}^k w_{i, \ell}^{(t)} h_\ell^{(t)}(x_i) \]

Parameters:
pData The input data.
pWeakHypothesis The current weak hypothesis.
Date:
16/11/2005

Definition at line 176 of file OutputInfo.cpp.

References OutputInfo::_outStream, BaseLearner::classify(), InputData::getBinaryClass(), ClassMappings::getNumClasses(), InputData::getNumExamples(), and InputData::getWeight().

void outputError InputData pData,
BaseLearner pWeakHypothesis
 

Output the error of the given data.

The error is computed by holding the information on the previous weak hypotheses. In AdaBoost, the error is computed with the formula

\[ {\bf g}(x) = \sum_{t=1}^T \alpha^{(t)} {\bf h}^{(t)}(x), \]

we therefore update the ${\bf g}(x)$ vector (for each example) each time this method is called:

\[ {\bf g} = {\bf g} + \alpha^{(t)} {\bf h}^{(t)}(x). \]

Remarks:
There can be any number of data to have the gTable. Each one is mapped into a map that uses the pointer of the data as key.
Parameters:
pData The input data.
pWeakHypothesis The current weak hypothesis.
See also:
table

_gTableMap

Date:
16/11/2005

Definition at line 54 of file OutputInfo.cpp.

References OutputInfo::_gTableMap, ClassMappings::getNumClasses(), and InputData::getNumExamples().

Referenced by Classifier::computeResults().

void outputIteration const int  t  ) 
 

Just output the iteration number.

Parameters:
t The iteration number.
Date:
14/11/2005

Definition at line 47 of file OutputInfo.cpp.

References OutputInfo::_outStream.

Referenced by Classifier::computeResults().

void outputMargins InputData pData,
BaseLearner pWeakHypothesis
 

Output the minimum margin the sum of below zero margins.

These two elements are useful for an analysis of the training process.

The margins are represent the per-class weighted correct rate, that is

\[ \rho_{i, \ell} = \sum_{t=1}^T \alpha^{(t)} h_\ell^{(t)}(x_i) y_i \]

The fist value that this method outputs is the minimum margin, that is

\[ \rho_{min} = \mathop{\rm arg\, min}_{i, \ell} \rho_{i, \ell}, \]

which is normalized by the sum of alpha

\[ \frac{\rho_{min}}{\sum_{t=1}^T \alpha^{(t)}}. \]

This can give a useful measure of the size of the functional margin.

The second value which this method outputs is simply the sum of the margins below zero.

Parameters:
pData The input data.
pWeakHypothesis The current weak hypothesis.
Date:
16/11/2005

Definition at line 111 of file OutputInfo.cpp.

References ClassMappings::getNumClasses().


Member Data Documentation

map<InputData*, double> _alphaSums [protected]
 

Maps the data to the sum of the alpha.

It is needed to keep this information saved from iteration to iteration.

See also:
outputMargins()
Date:
16/11/2005

Definition at line 187 of file OutputInfo.h.

map<InputData*, table> _gTableMap [protected]
 

Maps the data to its g(x) table.

It is needed to keep this information saved from iteration to iteration.

See also:
table

outputError()

Date:
16/11/2005

Definition at line 168 of file OutputInfo.h.

Referenced by OutputInfo::outputError().

map<InputData*, table> _margins [protected]
 

Maps the data to the margins table.

It is needed to keep this information saved from iteration to iteration.

See also:
table

outputMargins()

Date:
16/11/2005

Definition at line 178 of file OutputInfo.h.


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