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 149 return weakClassifierType;
163 return numInputDimensions;
166 bool getTrainingLoggingEnabled()
const{
167 return trainingLog.getLoggingEnabled();
170 bool setTrainingLoggingEnabled(
const bool enabled){
171 return trainingLog.setLoggingEnabled(enabled);
185 static WeakClassifier* createInstanceFromString( std::string
const &weakClassifierType );
202 static StringWeakClassifierMap *getMap() {
203 if( !stringWeakClassifierMap ){ stringWeakClassifierMap =
new StringWeakClassifierMap; }
204 return stringWeakClassifierMap;
208 static StringWeakClassifierMap *stringWeakClassifierMap;
209 static UINT numWeakClassifierInstances;
213 template<
typename T >
WeakClassifier *newWeakClassificationModuleInstance() {
return new T; }
215 template<
typename T >
219 getMap()->insert( std::pair< std::string,
WeakClassifier*(*)() >(newWeakClassificationModuleName, &newWeakClassificationModuleInstance< T > ) );
225 #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)
std::map< std::string, WeakClassifier *(*)() > StringWeakClassifierMap
bool trained
A flag to show if the weak classifier model has been trained.
virtual void print() const