31 #ifndef GRT_MLBASE_HEADER
32 #define GRT_MLBASE_HEADER
35 #include "../DataStructures/UnlabelledData.h"
36 #include "../DataStructures/ClassificationData.h"
37 #include "../DataStructures/ClassificationDataStream.h"
38 #include "../DataStructures/RegressionData.h"
39 #include "../DataStructures/TimeSeriesClassificationData.h"
43 #define DEFAULT_NULL_LIKELIHOOD_VALUE 0
44 #define DEFAULT_NULL_DISTANCE_VALUE 0
251 virtual bool reset();
259 virtual bool clear();
267 virtual bool print()
const;
275 virtual bool save(
const std::string filename)
const;
283 virtual bool load(
const std::string filename);
326 virtual bool getModel(std::ostream &stream)
const;
339 Float
inline scale(
const Float &x,
const Float &minSource,
const Float &maxSource,
const Float &minTarget,
const Float &maxTarget,
const bool constrain=
false){
341 if( x <= minSource )
return minTarget;
342 if( x >= maxSource )
return maxTarget;
344 if( minSource == maxSource )
return minTarget;
345 return (((x-minSource)*(maxTarget-minTarget))/(maxSource-minSource))+minTarget;
724 UINT numInputDimensions;
725 UINT numOutputDimensions;
726 UINT numTrainingIterationsToConverge;
729 UINT validationSetSize;
732 Float rootMeanSquaredTrainingError;
733 Float totalSquaredTrainingError;
734 Float validationSetAccuracy;
735 bool useValidationSet;
736 bool randomiseTrainingOrder;
740 std::vector< TrainingResult > trainingResults;
746 enum BaseTypes{BASE_TYPE_NOT_SET=0,CLASSIFIER,REGRESSIFIER,CLUSTERER};
751 #endif //GRT_MLBASE_HEADER
bool saveBaseSettingsToFile(std::fstream &file) const
bool setLearningRate(const Float learningRate)
virtual bool predict(VectorFloat inputVector)
bool setRandomiseTrainingOrder(const bool randomiseTrainingOrder)
bool notifyTrainingResultsObservers(const TrainingResult &data)
bool registerTrainingResultsObserver(Observer< TrainingResult > &observer)
Float scale(const Float &x, const Float &minSource, const Float &maxSource, const Float &minTarget, const Float &maxTarget, const bool constrain=false)
virtual bool predict_(VectorFloat &inputVector)
bool setTrainingLoggingEnabled(const bool loggingEnabled)
Float getLearningRate() const
bool removeAllTestObservers()
bool enableScaling(const bool useScaling)
DataType getOutputType() const
virtual bool getModel(std::ostream &stream) const
virtual bool train(ClassificationData trainingData)
Float getRootMeanSquaredTrainingError() const
UINT getMinNumEpochs() const
UINT getNumOutputDimensions() const
bool getScalingEnabled() const
bool registerTestResultsObserver(Observer< TestInstanceResult > &observer)
bool setMinChange(const Float minChange)
UINT getValidationSetSize() const
bool getRandomiseTrainingOrder() const
bool getUseValidationSet() const
virtual bool save(const std::string filename) const
virtual bool load(const std::string filename)
Float getMinChange() const
UINT getMaxNumEpochs() const
bool getModelTrained() const
Float getTotalSquaredTrainingError() const
bool setValidationSetSize(const UINT validationSetSize)
virtual bool saveModelToFile(std::string filename) const
bool copyMLBaseVariables(const MLBase *mlBase)
virtual bool print() const
Float getValidationSetAccuracy() const
bool getIsBaseTypeClusterer() const
virtual std::string getModelAsString() const
virtual bool loadModelFromFile(std::string filename)
bool setMinNumEpochs(const UINT minNumEpochs)
This file contains the GRTBase class. This is the core base class for all the GRT modules...
bool loadBaseSettingsFromFile(std::fstream &file)
MLBase * getMLBasePointer()
bool removeAllTrainingObservers()
UINT getNumInputFeatures() const
virtual bool train_(ClassificationData &trainingData)
bool notifyTestResultsObservers(const TestInstanceResult &data)
bool getIsBaseTypeClassifier() const
VectorFloat getValidationSetPrecision() const
DataType getInputType() const
bool removeTrainingResultsObserver(const Observer< TrainingResult > &observer)
UINT getNumInputDimensions() const
bool removeTestResultsObserver(const Observer< TestInstanceResult > &observer)
virtual bool map_(VectorFloat &inputVector)
UINT getNumTrainingIterationsToConverge() const
bool setUseValidationSet(const bool useValidationSet)
bool setMaxNumEpochs(const UINT maxNumEpochs)
Vector< TrainingResult > getTrainingResults() const
virtual bool map(VectorFloat inputVector)
VectorFloat getValidationSetRecall() const
bool getIsBaseTypeRegressifier() const