#include <InputData.h>
Inheritance diagram for InputData:
Public Member Functions | |
InputData () | |
The constructor. | |
virtual | ~InputData () |
Destructor of the class InputData. | |
virtual void | initOptions (nor_utils::Args &args) |
Set the arguments of the algorithm using the standard interface of the arguments. | |
virtual void | load (const string &fileName, const eInputType inputType=IT_TRAIN, const int verboseLevel=1) |
Load the given file. | |
virtual const int | getClass (const int idx) const |
Gets the label of the given example. | |
virtual const double | getValue (const int idx, const int columnIdx) const |
Get the value of the example idx and column columnIdx. | |
virtual const int | getBinaryClass (const int idx, const int classIdx) const |
Gets the binary label of the given example. | |
virtual double | getWeight (const int idx, const int classIdx) const |
Return the weight of class classIdx and example idx. | |
virtual void | setWeight (const int idx, const int classIdx, const double value) |
Set the value of weight of class classIdx and example idx. | |
int | getNumColumns () const |
Returns the number of columns. | |
int | getNumExamples () const |
Returns the number of examples. | |
int | getNumExamplesPerClass (const int classIdx) const |
Get the number of examples per class. | |
Protected Member Functions | |
virtual void | initWeights () |
Initialize the weights. | |
Protected Attributes | |
int | _numColumns |
The number of columns (dimensions). | |
int | _numExamples |
The number of examples. | |
vector< int > | _nExamplesPerClass |
The number of examples per class. | |
bool | _hasFileName |
true if each example has a filename as the very first column | |
bool | _classInLastColumn |
true if the class is in the last column instead of the first | |
vector< Example > | _data |
the data of the examples. | |
Classes | |
struct | Example |
Holds the data of the single example. More... |
This class not just holds the data information but also the weights on examples and labels. It also stores the sorted data (for decision stump algorithms) if necessary.
Here is an example of valid data (note: in this case the argument -hasfilename has been provided!):
/home/music/classical/classical.00078.au classical 5.72939e+01 2.95128e+02 6.43395e+00 /home/music/disco/disco.00078.au disco 1.98315e+02 1.31341e+03 -6.15398e+00 /home/music/reggae/reggae.00022.au reggae 2.51418e+02 7.68241e+02 -5.66704e+00 /home/music/hiphop/hiphop.00080.au hiphop 2.62773e+02 4.83971e+02 8.80924e-01 /home/music/rock/rock.00015.au rock 2.03546e+02 9.31192e+02 -7.56387e+00 1.15847e+02 /home/music/hiphop/hiphop.00027.au hiphop 2.37860e+02 1.03110e+03 2.50052e-01 /home/music/rock/rock.00094.au rock 2.48359e+02 1.69432e+02 -1.66508e+01
Definition at line 81 of file InputData.h.
|
The constructor. It does noting but initializing some variables.
Definition at line 89 of file InputData.h. |
|
Destructor of the class InputData. It erases the allocated memory of structure Example.
Definition at line 50 of file InputData.cpp. References InputData::_data, and InputData::_numExamples. |
|
Gets the binary label of the given example. It is defined as
Definition at line 147 of file InputData.h. References InputData::_data. Referenced by OutputInfo::outputEdge(), and AdaBoostLearner::updateWeights(). |
|
Gets the label of the given example.
Definition at line 125 of file InputData.h. References InputData::_data. Referenced by SingleStumpLearner::findThreshold(), MultiStumpLearner::findThresholds(), and Classifier::getOverallError(). |
|
Get the number of examples per class.
Definition at line 176 of file InputData.h. References InputData::_nExamplesPerClass. |
|
Get the value of the example idx and column columnIdx.
Definition at line 133 of file InputData.h. References InputData::_data. Referenced by StumpLearner::classify(). |
|
Return the weight of class classIdx and example idx.
Definition at line 156 of file InputData.h. References InputData::_data. Referenced by SingleStumpLearner::findThreshold(), MultiStumpLearner::findThresholds(), OutputInfo::outputEdge(), and AdaBoostLearner::updateWeights(). |
|
Set the arguments of the algorithm using the standard interface of the arguments. Call this to set the arguments asked by the user.
Definition at line 56 of file InputData.cpp. References InputData::_classInLastColumn, InputData::_hasFileName, and Args::hasArgument(). Referenced by AdaBoostLearner::run(). |
|
Initialize the weights. The weights initialization formula is defined as:
where is the number of examples and the number of classes.
Definition at line 187 of file InputData.cpp. References InputData::_data, InputData::_numExamples, and ClassMappings::getNumClasses(). |
|
Load the given file.
Reimplemented in SortedData. Definition at line 71 of file InputData.cpp. Referenced by SortedData::load(), and AdaBoostLearner::run(). |
|
Set the value of weight of class classIdx and example idx.
Definition at line 165 of file InputData.h. References InputData::_data. Referenced by AdaBoostLearner::updateWeights(). |