ClassMappings Class Reference

An static class with the class mappings. More...

#include <ClassMappings.h>

List of all members.

Static Public Member Functions

static int addClassName (const string &className)
 Add a class name to the registered list.
static void loadClassMapFile (const string &classMapFileName)
 Load a class file.
static string getClassNameFromIdx (const int idx)
 Get the class name using the index.
static int getIdxFromClassName (const string &className)
 Get the index using the class name Example:.
static int getNumClasses ()
 Returns the number of classes.

Static Private Attributes

static vector< string > _mapIdxToClass
 Maps the internal index to the class: internal_index->class.
static map< string, int > _mapClassToIdx
 Maps the class to the internal index: class->internal_index.
static int _numRegClasses = 0
 The number of the classes registered.


Detailed Description

An static class with the class mappings.

Each class (or label) is mapped into an index for efficiency reasons.

Date:
14/11/2005

Definition at line 46 of file ClassMappings.h.


Member Function Documentation

int addClassName const string &  className  )  [static]
 

Add a class name to the registered list.

Parameters:
className The name of the class to add.
Date:
22/11/2005

Definition at line 41 of file ClassMappings.cpp.

References ClassMappings::_mapClassToIdx, ClassMappings::_mapIdxToClass, and ClassMappings::_numRegClasses.

string getClassNameFromIdx const int  idx  )  [static]
 

Get the class name using the index.

Example:

 getClassNameFromIdx(0); // -> "rock"
Parameters:
idx The index of the class.
Date:
14/11/2005

Definition at line 76 of file ClassMappings.cpp.

Referenced by Classifier::run(), and Serialization::vectorTag().

int getIdxFromClassName const string &  className  )  [static]
 

Get the index using the class name Example:.

 getIdxFromClassName("rock"); // -> 0
Parameters:
className The name of the class.
Date:
14/11/2005

Definition at line 92 of file ClassMappings.cpp.

References ClassMappings::_mapClassToIdx.

Referenced by UnSerialization::seekAndParseVectorTag().

void loadClassMapFile const string &  classMapFileName  )  [static]
 

Load a class file.

The class file contains the list of the classes that will be used during learning or classification. The format of the file is just a list of names separated by white spaces. Example:

country metal rock blues classical pop disco blues hiphop reggae 
Parameters:
classMapFileName The name of the file to load.
Date:
22/11/2005

Definition at line 56 of file ClassMappings.cpp.


Member Data Documentation

map< string, int > _mapClassToIdx [static, private]
 

Maps the class to the internal index: class->internal_index.

See also:
getIdxFromClassName
Date:
10/11/2005

Definition at line 105 of file ClassMappings.h.

Referenced by ClassMappings::addClassName(), and ClassMappings::getIdxFromClassName().

vector< string > _mapIdxToClass [static, private]
 

Maps the internal index to the class: internal_index->class.

See also:
getClassNameFromIdx
Date:
10/11/2005

Definition at line 98 of file ClassMappings.h.

Referenced by ClassMappings::addClassName().


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