21 #define GRT_DLL_EXPORTS 27 UINT Regressifier::numRegressifierInstances = 0;
31 Regressifier* Regressifier::createInstanceFromString(
const std::string &
id ){
return create(
id); }
32 std::string Regressifier::getRegressifierType()
const{
return MLBase::getId(); }
36 StringRegressifierMap::iterator iter = getMap()->find(
id );
37 if( iter == getMap()->end() ){
40 return iter->second();
51 if( newInstance == NULL )
return NULL;
62 numOutputDimensions = 0;
63 numRegressifierInstances++;
67 if( --numRegressifierInstances == 0 ){
68 delete stringRegressifierMap;
69 stringRegressifierMap = NULL;
76 StringRegressifierMap::iterator iter = getMap()->begin();
77 while( iter != getMap()->end() ){
78 registeredRegressifiers.push_back( iter->first );
81 return registeredRegressifiers;
86 if( regressifier == NULL ){
87 errorLog <<
"copyBaseVariables(Regressifier *regressifier) - regressifier pointer is NULL!" << std::endl;
95 this->regressifierType = regressifier->regressifierType;
96 this->regressionData = regressifier->regressionData;
97 this->inputVectorRanges = regressifier->inputVectorRanges;
98 this->targetVectorRanges = regressifier->targetVectorRanges;
117 regressionData.clear();
118 inputVectorRanges.clear();
119 targetVectorRanges.clear();
126 return regressionData;
132 return inputVectorRanges;
136 return targetVectorRanges;
145 if( !file.is_open() ){
146 errorLog <<
"saveBaseSettingsToFile(fstream &file) - The file is not open!" << std::endl;
154 file <<
"InputVectorRanges: \n";
155 for(UINT j=0; j<numInputDimensions; j++){
156 file << inputVectorRanges[j].minValue <<
"\t" << inputVectorRanges[j].maxValue << std::endl;
159 file <<
"OutputVectorRanges: \n";
160 for(UINT j=0; j<numOutputDimensions; j++){
161 file << targetVectorRanges[j].minValue <<
"\t" << targetVectorRanges[j].maxValue << std::endl;
170 if( !file.is_open() ){
171 errorLog <<
"loadBaseSettingsFromFile(fstream &file) - The file is not open!" << std::endl;
185 if( word !=
"InputVectorRanges:" ){
186 errorLog <<
"loadBaseSettingsFromFile(fstream &file) - Failed to read InputVectorRanges header!" << std::endl;
189 inputVectorRanges.
resize(numInputDimensions);
190 for(UINT j=0; j<numInputDimensions; j++){
191 file >> inputVectorRanges[j].minValue;
192 file >> inputVectorRanges[j].maxValue;
196 if( word !=
"OutputVectorRanges:" ){
197 errorLog <<
"loadBaseSettingsFromFile(fstream &file) - Failed to read OutputVectorRanges header!" << std::endl;
200 targetVectorRanges.
resize(numOutputDimensions);
201 for(UINT j=0; j<numOutputDimensions; j++){
202 file >> targetVectorRanges[j].minValue;
203 file >> targetVectorRanges[j].maxValue;
209 regressionData.clear();
210 regressionData.
resize(numOutputDimensions,0);
Vector< MinMax > getOutputRanges() const
bool saveBaseSettingsToFile(std::fstream &file) const
std::string getId() const
std::map< std::string, Regressifier *(*)() > StringRegressifierMap
virtual bool clear() override
virtual bool resize(const unsigned int size)
Regressifier * create() const
bool copyBaseVariables(const Regressifier *regressifier)
virtual bool reset() override
static Vector< std::string > getRegisteredRegressifiers()
virtual bool deepCopyFrom(const Regressifier *regressifier)
bool saveBaseSettingsToFile(std::fstream &file) const
bool copyMLBaseVariables(const MLBase *mlBase)
bool loadBaseSettingsFromFile(std::fstream &file)
Vector< MinMax > getInputRanges() const
Regressifier * deepCopy() const
bool loadBaseSettingsFromFile(std::fstream &file)
virtual ~Regressifier(void)
const Regressifier & getBaseRegressifier() const
VectorFloat getRegressionData() const
std::string classId
Stores the name of the class (e.g., MinDist)
This is the main base class that all GRT machine learning algorithms should inherit from...
This is the main base class that all GRT Regression algorithms should inherit from.
Regressifier(const std::string &id="")