29 #ifndef GRT_WEAK_CLASSIFIER_HEADER
30 #define GRT_WEAK_CLASSIFIER_HEADER
32 #include "../../../Util/GRTCommon.h"
33 #include "../../../DataStructures/ClassificationData.h"
37 #define WEAK_CLASSIFIER_POSITIVE_CLASS_LABEL 1
38 #define WEAK_CLASSIFIER_NEGATIVE_CLASS_LABEL 2
190 TrainingLog trainingLog;
194 static StringWeakClassifierMap *getMap() {
196 return stringWeakClassifierMap;
200 static StringWeakClassifierMap *stringWeakClassifierMap;
201 static UINT numWeakClassifierInstances;
205 template<
typename T >
WeakClassifier *newWeakClassificationModuleInstance() {
return new T; }
207 template<
typename T >
211 getMap()->insert( std::pair< std::string,
WeakClassifier*(*)() >(newWeakClassificationModuleName, &newWeakClassificationModuleInstance< T > ) );
217 #endif //GRT_WEAK_CLASSIFIER_HEADER
virtual Float predict(const VectorFloat &x)
std::string weakClassifierType
A string that represents the weak classifier type, e.g. DecisionStump.
virtual bool deepCopyFrom(const WeakClassifier *weakClassifer)
UINT numInputDimensions
The number of input dimensions to the weak classifier.
virtual bool saveModelToFile(std::fstream &file) const
std::string getWeakClassifierType() const
virtual Float getNegativeClassLabel() const
WeakClassifier(const WeakClassifier &rhs)
virtual bool train(ClassificationData &trainingData, VectorFloat &weights)
UINT getNumInputDimensions() const
virtual Float getPositiveClassLabel() const
virtual bool loadModelFromFile(std::fstream &file)
WeakClassifier * createNewInstance() const
WeakClassifier & operator=(const WeakClassifier &rhs)
bool copyBaseVariables(const WeakClassifier *weakClassifer)
std::map< std::string, WeakClassifier *(*)() > StringWeakClassifierMap
bool trained
A flag to show if the weak classifier model has been trained.
static WeakClassifier * createInstanceFromString(std::string const &weakClassifierType)
virtual ~WeakClassifier()
virtual void print() const