#include <Classifier.h>
Public Member Functions | |
Classifier (nor_utils::Args &args, int verbose=1) | |
The constructor. | |
void | run (const string &dataFileName, const string ­pFileName, const int numRanksEnclosed=2) |
Starts the classification process. | |
Protected Member Functions | |
InputData * | loadInputData (const string &dataFileName, const string ­pFileName) |
Loads the data. | |
void | computeResults (InputData *pData, vector< BaseLearner * > &weakHypotheses, vector< ExampleResults > &results) |
Compute the results using the weak hypotheses. | |
double | getOverallError (InputData *pData, const vector< ExampleResults > &results, int atLeastRank=0) |
Compute the overall error on the data. | |
void | getClassError (InputData *pData, const vector< ExampleResults > &results, vector< double > &classError, int atLeastRank=0) |
Compute the error per class. | |
Protected Attributes | |
int | _verbose |
Defines the level of verbosity:
| |
nor_utils::Args & | _args |
The arguments defined by the user. | |
string | _outputInfoFile |
The filename of the step-by-step information file that will be updated. | |
Classes | |
class | ExampleResults |
Holds the results per example. More... |
Using the strong hypothesis file (shyp.xml by default) it builds the list of weak hypothesis (or weak learners), and use them to perform a classification over the given data set. The strong hypothesis is the linear combination of the weak hypotheses and their confidence alpha, and is defined as:
where the bold defines a vector as returned value. To obtain a single class, we simply take the winning class that receives the "most vote", that is:
Definition at line 62 of file Classifier.h.
|
The constructor. It initializes the variable and set them using the information provided by the arguments passed. They are parsed using the helpers provided by class Args.
Definition at line 32 of file Classifier.cpp. References Classifier::_outputInfoFile, Args::getValue(), and Args::hasArgument(). |
|
Compute the results using the weak hypotheses. This method is the one that effectively computes .
Definition at line 178 of file Classifier.cpp. References Classifier::_outputInfoFile, OutputInfo::endLine(), ClassMappings::getNumClasses(), InputData::getNumExamples(), OutputInfo::outputError(), and OutputInfo::outputIteration(). Referenced by Classifier::ExampleResults::getRankedList(), and Classifier::run(). |
|
Compute the error per class.
Definition at line 260 of file Classifier.cpp. References ClassMappings::getNumClasses(). Referenced by Classifier::ExampleResults::getRankedList(), and Classifier::run(). |
|
Compute the overall error on the data.
Definition at line 238 of file Classifier.cpp. References InputData::getClass(), and InputData::getNumExamples(). Referenced by Classifier::ExampleResults::getRankedList(), and Classifier::run(). |
|
Loads the data. It needs the Strong Hypothesis file because it needs the information about the weak learner used to generate it. The weak learner might have associated a special InputData derived class, which is returned by BaseLearner::createInputData() once the weak learner has been identified.
Definition at line 133 of file Classifier.cpp. Referenced by Classifier::run(). |
|
Starts the classification process.
Definition at line 42 of file Classifier.cpp. References Classifier::_verbose, Classifier::computeResults(), Classifier::getClassError(), ClassMappings::getClassNameFromIdx(), ClassMappings::getNumClasses(), InputData::getNumExamples(), Classifier::getOverallError(), UnSerialization::loadHypotheses(), and Classifier::loadInputData(). |