Serialization Class Reference

The serialization (saving) of the weak learners found. More...

#include <Serialization.h>

List of all members.

Public Member Functions

 Serialization (const string &shypFileName, const string &weakLearnerName)
 The constructor.
 ~Serialization ()
 The destructor.
void saveHypotheses (vector< BaseLearner * > &weakHypotheses)
 Save all the weak hypothesis all at once.
void appendHypothesis (const int iteration, BaseLearner *pWeakHypothesis)
 Append the passed weak hypothesis to the file.

Static Public Member Functions

template<typename T>
static string standardTag (const string &tagName, const T &value, const int numTab=0)
 Create a standard xml <tag>value<\tag>.
template<typename T>
static string vectorTag (const string &tagName, const vector< T > &values, const int numTab=0)
 Create a set of xml tags that describes a vector.

Static Private Member Functions

static string getTabs (const int numTabs)
 Create a string which contains only tab characters.

Private Attributes

string _shypFileName
 The strong learner file name.


Detailed Description

The serialization (saving) of the weak learners found.

See also:
UnSerialization
Date:
13/11/2005

Definition at line 52 of file Serialization.h.


Constructor & Destructor Documentation

Serialization const string &  shypFileName,
const string &  weakLearnerName
 

The constructor.

Create the serialization object, and write the header.

Parameters:
shypFileName The name of the serialized strong hypothesis file.
weakLearnerName The name of the weak learner used to find the weak hypotheses.
Date:
16/11/2005

Definition at line 34 of file Serialization.cpp.

References Serialization::standardTag().

~Serialization  ) 
 

The destructor.

It just closes the xml tag.

Date:
16/11/2005

Definition at line 49 of file Serialization.cpp.

References Serialization::_shypFileName.


Member Function Documentation

void appendHypothesis const int  iteration,
BaseLearner pWeakHypothesis
 

Append the passed weak hypothesis to the file.

Parameters:
iteration The iteration index.
pWeakHypothesis The current weak hypothesis.
Date:
16/11/2005

Definition at line 67 of file Serialization.cpp.

References Serialization::_shypFileName, and BaseLearner::save().

Referenced by Serialization::saveHypotheses().

static string getTabs const int  numTabs  )  [inline, static, private]
 

Create a string which contains only tab characters.

Parameters:
numTabs the number of tabs.
Returns:
The string with only tabs.
Date:
13/11/2005

Definition at line 159 of file Serialization.h.

Referenced by Serialization::standardTag(), and Serialization::vectorTag().

void saveHypotheses vector< BaseLearner * > &  weakHypotheses  ) 
 

Save all the weak hypothesis all at once.

Parameters:
weakHypotheses The vector of weak hypotheses found during training.
Date:
16/11/2005

Definition at line 58 of file Serialization.cpp.

References Serialization::appendHypothesis().

static string standardTag const string &  tagName,
const T &  value,
const int  numTab = 0
[inline, static]
 

Create a standard xml <tag>value<\tag>.

Parameters:
tagName The name of the tag.
value The value enclosed in the tag opening and closing.
numTab The number of tabs before the tag. Useful for indentation.
Returns:
The string with the formatted tag and value.
Date:
16/11/2005

Definition at line 99 of file Serialization.h.

References Serialization::getTabs().

Referenced by StumpLearner::save(), SingleStumpLearner::save(), BaseLearner::save(), and Serialization::Serialization().

static string vectorTag const string &  tagName,
const vector< T > &  values,
const int  numTab = 0
[inline, static]
 

Create a set of xml tags that describes a vector.

For instance, if the vector values is [-1, 1, 1], with tagName="vArray", and the classes are ["one", "two", "three"] will return:

   <vArray size="3">
      <class id="one">-1</class>
      <class id="two">1</class>
      <class id="three">1</class>
   </vArray> 
Parameters:
tagName The name of the tag.
values The vector of the values.
numTab The number of tabs before the tag. Useful for indentation.
Date:
16/11/2005

Definition at line 126 of file Serialization.h.

References ClassMappings::getClassNameFromIdx(), and Serialization::getTabs().

Referenced by StumpLearner::save(), and MultiStumpLearner::save().


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