26 UINT Regressifier::numRegressifierInstances = 0;
30 StringRegressifierMap::iterator iter = getMap()->find( regressifierType );
31 if( iter == getMap()->end() ){
34 return iter->second();
45 if( newInstance == NULL )
return NULL;
55 baseType = MLBase::REGRESSIFIER;
56 regressifierType =
"NOT_SET";
57 numOutputDimensions = 0;
58 numRegressifierInstances++;
62 if( --numRegressifierInstances == 0 ){
63 delete stringRegressifierMap;
64 stringRegressifierMap = NULL;
70 if( regressifier == NULL ){
71 errorLog <<
"copyBaseVariables(Regressifier *regressifier) - regressifier pointer is NULL!" << std::endl;
79 this->regressifierType = regressifier->regressifierType;
80 this->regressionData = regressifier->regressionData;
81 this->inputVectorRanges = regressifier->inputVectorRanges;
82 this->targetVectorRanges = regressifier->targetVectorRanges;
92 rootMeanSquaredTrainingError = 0;
93 totalSquaredTrainingError = 0;
103 rootMeanSquaredTrainingError = 0;
104 totalSquaredTrainingError = 0;
105 regressionData.clear();
106 inputVectorRanges.clear();
107 targetVectorRanges.clear();
113 return regressifierType;
118 return regressionData;
124 return inputVectorRanges;
128 return targetVectorRanges;
138 if( !file.is_open() ){
139 errorLog <<
"saveBaseSettingsToFile(fstream &file) - The file is not open!" << std::endl;
147 file <<
"InputVectorRanges: \n";
148 for(UINT j=0; j<numInputDimensions; j++){
149 file << inputVectorRanges[j].minValue <<
"\t" << inputVectorRanges[j].maxValue << std::endl;
152 file <<
"OutputVectorRanges: \n";
153 for(UINT j=0; j<numOutputDimensions; j++){
154 file << targetVectorRanges[j].minValue <<
"\t" << targetVectorRanges[j].maxValue << std::endl;
164 if( !file.is_open() ){
165 errorLog <<
"loadBaseSettingsFromFile(fstream &file) - The file is not open!" << std::endl;
179 if( word !=
"InputVectorRanges:" ){
180 errorLog <<
"loadBaseSettingsFromFile(fstream &file) - Failed to read InputVectorRanges header!" << std::endl;
183 inputVectorRanges.
resize(numInputDimensions);
184 for(UINT j=0; j<numInputDimensions; j++){
185 file >> inputVectorRanges[j].minValue;
186 file >> inputVectorRanges[j].maxValue;
190 if( word !=
"OutputVectorRanges:" ){
191 errorLog <<
"loadBaseSettingsFromFile(fstream &file) - Failed to read OutputVectorRanges header!" << std::endl;
194 targetVectorRanges.
resize(numOutputDimensions);
195 for(UINT j=0; j<numOutputDimensions; j++){
196 file >> targetVectorRanges[j].minValue;
197 file >> targetVectorRanges[j].maxValue;
203 regressionData.clear();
204 regressionData.
resize(numOutputDimensions,0);
Vector< MinMax > getOutputRanges() const
bool saveBaseSettingsToFile(std::fstream &file) const
std::map< std::string, Regressifier *(*)() > StringRegressifierMap
virtual bool resize(const unsigned int size)
Regressifier * createNewInstance() const
static Regressifier * createInstanceFromString(const std::string ®ressifierType)
bool copyBaseVariables(const Regressifier *regressifier)
virtual bool deepCopyFrom(const Regressifier *regressifier)
bool saveBaseSettingsToFile(std::fstream &file) const
std::string getRegressifierType() 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
This is the main base class that all GRT Regression algorithms should inherit from.