GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
GRT::MLBase Class Reference
Inheritance diagram for GRT::MLBase:
GRT::GRTBase GRT::Observer< TrainingResult > GRT::Observer< TestInstanceResult > GRT::BernoulliRBM GRT::Classifier GRT::Clusterer GRT::Context GRT::ContinuousHiddenMarkovModel GRT::DiscreteHiddenMarkovModel GRT::FeatureExtraction GRT::LinearLeastSquares GRT::MeanShift GRT::MovementDetector GRT::PostProcessing GRT::PreProcessing GRT::Regressifier

Public Types

enum  BaseTypes { BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER }
 

Public Member Functions

 MLBase (void)
 
virtual ~MLBase (void)
 
bool copyMLBaseVariables (const MLBase *mlBase)
 
virtual bool train (ClassificationData trainingData)
 
virtual bool train_ (ClassificationData &trainingData)
 
virtual bool train (RegressionData trainingData)
 
virtual bool train_ (RegressionData &trainingData)
 
virtual bool train (TimeSeriesClassificationData trainingData)
 
virtual bool train_ (TimeSeriesClassificationData &trainingData)
 
virtual bool train (TimeSeriesClassificationDataStream trainingData)
 
virtual bool train_ (TimeSeriesClassificationDataStream &trainingData)
 
virtual bool train (UnlabelledData trainingData)
 
virtual bool train_ (UnlabelledData &trainingData)
 
virtual bool train (MatrixDouble data)
 
virtual bool train_ (MatrixDouble &data)
 
virtual bool predict (VectorDouble inputVector)
 
virtual bool predict_ (VectorDouble &inputVector)
 
virtual bool predict (MatrixDouble inputMatrix)
 
virtual bool predict_ (MatrixDouble &inputMatrix)
 
virtual bool map (VectorDouble inputVector)
 
virtual bool map_ (VectorDouble &inputVector)
 
virtual bool reset ()
 
virtual bool clear ()
 
virtual bool print () const
 
virtual bool save (const string filename) const
 
virtual bool load (const string filename)
 
virtual bool saveModelToFile (string filename) const
 
virtual bool saveModelToFile (fstream &file) const
 
virtual bool loadModelFromFile (string filename)
 
virtual bool loadModelFromFile (fstream &file)
 
virtual bool getModel (ostream &stream) const
 
double scale (const double &x, const double &minSource, const double &maxSource, const double &minTarget, const double &maxTarget, const bool constrain=false)
 
virtual string getModelAsString () const
 
UINT getBaseType () const
 
UINT getNumInputFeatures () const
 
UINT getNumInputDimensions () const
 
UINT getNumOutputDimensions () const
 
UINT getMinNumEpochs () const
 
UINT getMaxNumEpochs () const
 
UINT getValidationSetSize () const
 
UINT getNumTrainingIterationsToConverge () const
 
double getMinChange () const
 
double getLearningRate () const
 
double getRootMeanSquaredTrainingError () const
 
double getTotalSquaredTrainingError () const
 
bool getUseValidationSet () const
 
bool getRandomiseTrainingOrder () const
 
bool getTrained () const
 
bool getModelTrained () const
 
bool getScalingEnabled () const
 
bool getIsBaseTypeClassifier () const
 
bool getIsBaseTypeRegressifier () const
 
bool getIsBaseTypeClusterer () const
 
bool enableScaling (bool useScaling)
 
bool setMaxNumEpochs (const UINT maxNumEpochs)
 
bool setMinNumEpochs (const UINT minNumEpochs)
 
bool setMinChange (const double minChange)
 
bool setLearningRate (double learningRate)
 
bool setUseValidationSet (const bool useValidationSet)
 
bool setValidationSetSize (const UINT validationSetSize)
 
bool setRandomiseTrainingOrder (const bool randomiseTrainingOrder)
 
bool registerTrainingResultsObserver (Observer< TrainingResult > &observer)
 
bool registerTestResultsObserver (Observer< TestInstanceResult > &observer)
 
bool removeTrainingResultsObserver (const Observer< TrainingResult > &observer)
 
bool removeTestResultsObserver (const Observer< TestInstanceResult > &observer)
 
bool removeAllTrainingObservers ()
 
bool removeAllTestObservers ()
 
bool notifyTrainingResultsObservers (const TrainingResult &data)
 
bool notifyTestResultsObservers (const TestInstanceResult &data)
 
MLBasegetMLBasePointer ()
 
const MLBasegetMLBasePointer () const
 
vector< TrainingResultgetTrainingResults () const
 
- Public Member Functions inherited from GRT::GRTBase
 GRTBase (void)
 
virtual ~GRTBase (void)
 
bool copyGRTBaseVariables (const GRTBase *GRTBase)
 
string getClassType () const
 
string getLastWarningMessage () const
 
string getLastErrorMessage () const
 
string getLastInfoMessage () const
 
GRTBasegetGRTBasePointer ()
 
const GRTBasegetGRTBasePointer () const
 
- Public Member Functions inherited from GRT::Observer< TrainingResult >
virtual void notify (const TrainingResult &data)
 
- Public Member Functions inherited from GRT::Observer< TestInstanceResult >
virtual void notify (const TestInstanceResult &data)
 

Protected Member Functions

bool saveBaseSettingsToFile (fstream &file) const
 
bool loadBaseSettingsFromFile (fstream &file)
 
- Protected Member Functions inherited from GRT::GRTBase
double SQR (const double &x) const
 

Protected Attributes

bool trained
 
bool useScaling
 
UINT baseType
 
UINT numInputDimensions
 
UINT numOutputDimensions
 
UINT numTrainingIterationsToConverge
 
UINT minNumEpochs
 
UINT maxNumEpochs
 
UINT validationSetSize
 
double learningRate
 
double minChange
 
double rootMeanSquaredTrainingError
 
double totalSquaredTrainingError
 
bool useValidationSet
 
bool randomiseTrainingOrder
 
Random random
 
vector< TrainingResulttrainingResults
 
TrainingResultsObserverManager trainingResultsObserverManager
 
TestResultsObserverManager testResultsObserverManager
 
- Protected Attributes inherited from GRT::GRTBase
string classType
 
DebugLog debugLog
 
ErrorLog errorLog
 
InfoLog infoLog
 
TrainingLog trainingLog
 
TestingLog testingLog
 
WarningLog warningLog
 

Additional Inherited Members

- Static Public Member Functions inherited from GRT::GRTBase
static string getGRTVersion (bool returnRevision=true)
 
static string getGRTRevison ()
 

Detailed Description

Definition at line 70 of file MLBase.h.

Constructor & Destructor Documentation

GRT::MLBase::MLBase ( void  )

Default MLBase Constructor

Definition at line 25 of file MLBase.cpp.

GRT::MLBase::~MLBase ( void  )
virtual

Default MLBase Destructor

Definition at line 42 of file MLBase.cpp.

Member Function Documentation

bool GRT::MLBase::clear ( )
virtual

This is the main clear interface for all the GRT machine learning algorithms. It will completely clear the ML module, removing any trained model and setting all the base variables to their default values.

Returns
returns true if the derived class was cleared succesfully, false otherwise

Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::DTW, GRT::HMM, GRT::FiniteStateMachine, GRT::AdaBoost, GRT::ANBC, GRT::SVM, GRT::FFT, GRT::KNN, GRT::DecisionTree, GRT::BAG, GRT::GMM, GRT::RandomForests, GRT::RBMQuantizer, GRT::ParticleClassifier, GRT::KMeansQuantizer, GRT::SOMQuantizer, GRT::ClusterTree, GRT::RegressionTree, GRT::FIRFilter, GRT::MinDist, GRT::Softmax, GRT::SwipeDetector, GRT::Clusterer, GRT::MLP, GRT::BernoulliRBM, GRT::KMeans, GRT::FeatureExtraction, GRT::PreProcessing, GRT::GaussianMixtureModels, GRT::Regressifier, GRT::Classifier, GRT::ContinuousHiddenMarkovModel, and GRT::MovementDetector.

Definition at line 118 of file MLBase.cpp.

bool GRT::MLBase::copyMLBaseVariables ( const MLBase mlBase)

This copies all the MLBase variables from the instance mlBaseA to the instance mlBaseA.

Parameters
constMLBase *mlBase: a pointer to a MLBase class from which the values will be copied to the instance that calls the function
Returns
returns true if the copy was successfull, false otherwise

Definition at line 46 of file MLBase.cpp.

bool GRT::MLBase::enableScaling ( bool  useScaling)

Sets if scaling should be used during the training and prediction phases.

Returns
returns true the scaling parameter was updated, false otherwise

Definition at line 235 of file MLBase.cpp.

UINT GRT::MLBase::getBaseType ( ) const

Gets the current ML base type.

Returns
returns an UINT representing the current ML base type, this will be one of the BaseTypes enumerations

Definition at line 184 of file MLBase.cpp.

bool GRT::MLBase::getIsBaseTypeClassifier ( ) const

Gets if the derived class type is CLASSIFIER.

Returns
returns true if the derived class type is CLASSIFIER, false otherwise

Definition at line 229 of file MLBase.cpp.

bool GRT::MLBase::getIsBaseTypeClusterer ( ) const

Gets if the derived class type is CLUSTERER.

Returns
returns true if the derived class type is CLUSTERER, false otherwise

Definition at line 233 of file MLBase.cpp.

bool GRT::MLBase::getIsBaseTypeRegressifier ( ) const

Gets if the derived class type is REGRESSIFIER.

Returns
returns true if the derived class type is REGRESSIFIER, false otherwise

Definition at line 231 of file MLBase.cpp.

double GRT::MLBase::getLearningRate ( ) const

Gets the current learningRate value, this is value used to update the weights at each step of a learning algorithm such as stochastic gradient descent.

Returns
returns the current learningRate value

Definition at line 211 of file MLBase.cpp.

UINT GRT::MLBase::getMaxNumEpochs ( ) const

Gets the maximum number of epochs. This value controls the maximum number of epochs that can be used by the training algorithm. An epoch is a complete iteration of all training samples.

Returns
returns the maximum number of epochs

Definition at line 203 of file MLBase.cpp.

double GRT::MLBase::getMinChange ( ) const

Gets the minimum change value that controls when the training algorithm should stop.

Returns
returns the minimum change value
UINT GRT::MLBase::getMinNumEpochs ( ) const

Gets the minimum number of epochs. This is the minimum number of epochs that can elapse with no change between two training epochs. An epoch is a complete iteration of all training samples.

Returns
returns the minimum number of epochs

Definition at line 199 of file MLBase.cpp.

MLBase * GRT::MLBase::getMLBasePointer ( )

This functions returns a pointer to the current instance.

Returns
returns a MLBase pointer to the current instance.

Definition at line 322 of file MLBase.cpp.

const MLBase * GRT::MLBase::getMLBasePointer ( ) const

This functions returns a const pointer to the current instance.

Returns
returns a const MLBase pointer to the current instance.

Definition at line 326 of file MLBase.cpp.

bool GRT::MLBase::getModel ( ostream &  stream) const
virtual

This function adds the current model to the formatted stream. This function should be overwritten by the derived class.

Parameters
ostream&file: a reference to the stream the model will be added to
Returns
returns true if the model was added successfully, false otherwise

Reimplemented in GRT::DecisionTree.

Definition at line 174 of file MLBase.cpp.

string GRT::MLBase::getModelAsString ( ) const
virtual

Gets the current model and settings as a string.

Returns
returns a string containing the model

Definition at line 176 of file MLBase.cpp.

bool GRT::MLBase::getModelTrained ( ) const

This function is now depreciated. You should use the getTrained() function instead.

Returns
returns true if the model for the derived class has been succesfully trained, false otherwise

Definition at line 225 of file MLBase.cpp.

UINT GRT::MLBase::getNumInputDimensions ( ) const

Gets the number of input dimensions in trained model.

Returns
returns the number of input dimensions

Definition at line 188 of file MLBase.cpp.

UINT GRT::MLBase::getNumInputFeatures ( ) const

Gets the number of input dimensions in trained model. This function is now depriciated and will be removed in the future, you should use getNumInputDimensions instead.

Returns
returns the number of input dimensions in the trained model, a value of 0 will be returned if the model has not been trained

Definition at line 186 of file MLBase.cpp.

UINT GRT::MLBase::getNumOutputDimensions ( ) const

Gets the number of output dimensions in trained model.

Returns
returns the number of output dimensions

Definition at line 190 of file MLBase.cpp.

UINT GRT::MLBase::getNumTrainingIterationsToConverge ( ) const

Gets the number of training iterations that were required for the algorithm to converge.

Returns
returns the number of training iterations required for the training algorithm to converge, a value of 0 will be returned if the model has not been trained

Definition at line 192 of file MLBase.cpp.

bool GRT::MLBase::getRandomiseTrainingOrder ( ) const

Returns true if the order of the training dataset should be randomized at each epoch of training. Randomizing the order of the training dataset stops a learning algorithm from focusing too much on the first few examples in the dataset.

Returns
returns true if the order of the training dataset should be randomized, false otherwise
double GRT::MLBase::getRootMeanSquaredTrainingError ( ) const

Gets the root mean squared error on the training data during the training phase.

Returns
returns the RMS error (on the training data during the training phase)

Definition at line 215 of file MLBase.cpp.

bool GRT::MLBase::getScalingEnabled ( ) const

Gets if the scaling has been enabled.

Returns
returns true if scaling is enabled, false otherwise

Definition at line 227 of file MLBase.cpp.

double GRT::MLBase::getTotalSquaredTrainingError ( ) const

Gets the total squared error on the training data during the training phase.

Returns
returns the total squared error (on the training data during the training phase)

Definition at line 219 of file MLBase.cpp.

bool GRT::MLBase::getTrained ( ) const

Gets if the model for the derived class has been succesfully trained.

Returns
returns true if the model for the derived class has been succesfully trained, false otherwise

Definition at line 223 of file MLBase.cpp.

vector< TrainingResult > GRT::MLBase::getTrainingResults ( ) const

Gets the training results from the last training phase. Each element in the vector represents the training results from 1 training iteration.

Returns
returns a vector of TrainingResult instances containing the training results from the most recent training phase

Definition at line 330 of file MLBase.cpp.

bool GRT::MLBase::getUseValidationSet ( ) const

Returns true if a validation set should be used for training. If true, then the training dataset will be partitioned into a smaller training dataset and a validation set.

The size of the partition is controlled by the validationSetSize parameter, for example, if the validationSetSize parameter is 20 then 20% of the training data will be used for a validation set leaving 80% of the original data to train the model.

Returns
returns true if a validation set should be used for training, false otherwise
UINT GRT::MLBase::getValidationSetSize ( ) const

Gets the size (as a percentage) of the validation set (if one should be used). If this value returned 20 this would mean that 20% of the training data would be set aside to create a validation set and the other 80% would be used to actually train the regression model. This will only happen if the useValidationSet parameter is set to true, otherwise 100% of the training data will be used to train the regression model.

Returns
returns the size of the validation set

Definition at line 207 of file MLBase.cpp.

bool GRT::MLBase::load ( const string  filename)
virtual

This saves the model to a file, it calls the loadModelFromFile(string filename) function unless it is overwritten by the derived class.

Parameters
conststring filename: the name of the file to save the model to
Returns
returns true if the model was saved successfully, false otherwise

Definition at line 153 of file MLBase.cpp.

bool GRT::MLBase::loadBaseSettingsFromFile ( fstream &  file)
protected

Loads the core base settings from a file.

Returns
returns true if the base settings were loaded, false otherwise

Definition at line 357 of file MLBase.cpp.

bool GRT::MLBase::loadModelFromFile ( string  filename)
virtual

This loads a trained model from a file, it calls the loadModelFromFile(fstream &file) function unless it is overwritten by the derived class.

Parameters
stringfilename: the name of the file to load the model from
Returns
returns true if the model was loaded successfully, false otherwise

Reimplemented in GRT::ClassLabelTimeoutFilter, GRT::FIRFilter, GRT::ClassLabelFilter, GRT::LowPassFilter, GRT::HighPassFilter, GRT::RBMQuantizer, GRT::Derivative, GRT::SOMQuantizer, GRT::ZeroCrossingCounter, GRT::SavitzkyGolayFilter, GRT::DeadZone, GRT::ClassLabelChangeFilter, GRT::DoubleMovingAverageFilter, GRT::MedianFilter, GRT::MovingAverageFilter, GRT::MovementTrajectoryFeatures, GRT::FFTFeatures, GRT::KMeansFeatures, GRT::MovementIndex, GRT::TimeseriesBuffer, GRT::PreProcessing, GRT::TimeDomainFeatures, and GRT::PostProcessing.

Definition at line 157 of file MLBase.cpp.

bool GRT::MLBase::loadModelFromFile ( fstream &  file)
virtual
bool GRT::MLBase::map ( VectorDouble  inputVector)
virtual

This is the main mapping interface for all the GRT machine learning algorithms. By defaut it will call the map_ function, unless it is overwritten by the derived class.

Parameters
VectorDoubleinputVector: the input vector for mapping/regression
Returns
returns true if the mapping was completed succesfully, false otherwise (the base class always returns false)

Definition at line 112 of file MLBase.cpp.

bool GRT::MLBase::map_ ( VectorDouble &  inputVector)
virtual

This is the main mapping interface by reference for all the GRT machine learning algorithms. This should be overwritten by the derived class.

Parameters
VectorDouble&inputVector: a reference to the input vector for mapping/regression
Returns
returns true if the mapping was completed succesfully, false otherwise (the base class always returns false)

Reimplemented in GRT::SelfOrganizingMap.

Definition at line 114 of file MLBase.cpp.

bool GRT::MLBase::notifyTestResultsObservers ( const TestInstanceResult data)

Notifies all observers that have subscribed to the test results observer manager.

Returns
returns true if all the observers were notified, false otherwise

Definition at line 318 of file MLBase.cpp.

bool GRT::MLBase::notifyTrainingResultsObservers ( const TrainingResult data)

Notifies all observers that have subscribed to the training results observer manager.

Returns
returns true if all the observers were notified, false otherwise

Definition at line 314 of file MLBase.cpp.

bool GRT::MLBase::predict ( VectorDouble  inputVector)
virtual

This is the main prediction interface for all the GRT machine learning algorithms. By defaut it will call the predict_ function, unless it is overwritten by the derived class.

Parameters
VectorDoubleinputVector: the new input vector for prediction
Returns
returns true if the prediction was completed succesfully, false otherwise (the base class always returns false)

Reimplemented in GRT::LDA.

Definition at line 104 of file MLBase.cpp.

bool GRT::MLBase::predict ( MatrixDouble  inputMatrix)
virtual

This is the prediction interface for time series data. By defaut it will call the predict_ function, unless it is overwritten by the derived class.

Parameters
MatrixDoubleinputMatrix: the new input matrix for prediction
Returns
returns true if the prediction was completed succesfully, false otherwise (the base class always returns false)

Definition at line 108 of file MLBase.cpp.

bool GRT::MLBase::predict_ ( VectorDouble &  inputVector)
virtual

This is the main prediction interface for all the GRT machine learning algorithms. This should be overwritten by the derived class.

Parameters
VectorDouble&inputVector: a reference to the input vector for prediction
Returns
returns true if the prediction was completed succesfully, false otherwise (the base class always returns false)

Reimplemented in GRT::DTW, GRT::KMeans, GRT::AdaBoost, GRT::HMM, GRT::SVM, GRT::GaussianMixtureModels, GRT::KNN, GRT::FiniteStateMachine, GRT::DecisionTree, GRT::ANBC, GRT::RandomForests, GRT::GMM, GRT::ClusterTree, GRT::RegressionTree, GRT::BAG, GRT::MinDist, GRT::Softmax, GRT::SwipeDetector, GRT::MLP, GRT::MultidimensionalRegression, GRT::LinearRegression, GRT::LogisticRegression, GRT::ParticleClassifier, GRT::BernoulliRBM, GRT::ContinuousHiddenMarkovModel, and GRT::MovementDetector.

Definition at line 106 of file MLBase.cpp.

bool GRT::MLBase::predict_ ( MatrixDouble inputMatrix)
virtual

This is the prediction interface for time series data. This should be overwritten by the derived class.

Parameters
MatrixDoubleinputMatrix: a reference to the new input matrix for prediction
Returns
returns true if the prediction was completed succesfully, false otherwise (the base class always returns false)

Reimplemented in GRT::DTW, GRT::HMM, and GRT::ContinuousHiddenMarkovModel.

Definition at line 110 of file MLBase.cpp.

bool GRT::MLBase::print ( ) const
virtual

This is the main print interface for all the GRT machine learning algorithms. This should be overwritten by the derived class. It will print the model and settings to the display log.

Returns
returns true if the model was printed succesfully, false otherwise (the base class always returns true)

Reimplemented in GRT::HMM, GRT::FiniteStateMachine, GRT::BernoulliRBM, GRT::RandomForests, GRT::ClusterTree, GRT::RegressionTree, GRT::MLP, GRT::DiscreteHiddenMarkovModel, and GRT::ContinuousHiddenMarkovModel.

Definition at line 129 of file MLBase.cpp.

bool GRT::MLBase::registerTestResultsObserver ( Observer< TestInstanceResult > &  observer)

Registers the observer with the test result observer manager. The observer will then be notified when any new test result is computed.

Returns
returns true the observer was added, false otherwise

Definition at line 294 of file MLBase.cpp.

bool GRT::MLBase::registerTrainingResultsObserver ( Observer< TrainingResult > &  observer)

Registers the observer with the training result observer manager. The observer will then be notified when any new training result is computed.

Returns
returns true the observer was added, false otherwise

Definition at line 290 of file MLBase.cpp.

bool GRT::MLBase::removeAllTestObservers ( )

Removes all observers from the training result observer manager.

Returns
returns true if all the observers were removed, false otherwise

Definition at line 310 of file MLBase.cpp.

bool GRT::MLBase::removeAllTrainingObservers ( )

Removes all observers from the training result observer manager.

Returns
returns true if all the observers were removed, false otherwise

Definition at line 306 of file MLBase.cpp.

bool GRT::MLBase::removeTestResultsObserver ( const Observer< TestInstanceResult > &  observer)

Removes the observer from the test result observer manager.

Returns
returns true if the observer was removed, false otherwise

Definition at line 302 of file MLBase.cpp.

bool GRT::MLBase::removeTrainingResultsObserver ( const Observer< TrainingResult > &  observer)

Removes the observer from the training result observer manager.

Returns
returns true if the observer was removed, false otherwise

Definition at line 298 of file MLBase.cpp.

bool GRT::MLBase::save ( const string  filename) const
virtual

This saves the model to a file, it calls the saveModelToFile(string filename) function unless it is overwritten by the derived class.

Parameters
conststring filename: the name of the file to save the model to
Returns
returns true if the model was saved successfully, false otherwise

Definition at line 131 of file MLBase.cpp.

bool GRT::MLBase::saveBaseSettingsToFile ( fstream &  file) const
protected

Saves the core base settings to a file.

Returns
returns true if the base settings were saved, false otherwise

Definition at line 334 of file MLBase.cpp.

bool GRT::MLBase::saveModelToFile ( string  filename) const
virtual

This saves the trained model to a file, it calls the saveModelToFile(fstream &file) function unless it is overwritten by the derived class.

Parameters
stringfilename: the name of the file to save the model to
Returns
returns true if the model was saved successfully, false otherwise

Reimplemented in GRT::ClassLabelTimeoutFilter, GRT::RBMQuantizer, GRT::SOMQuantizer, GRT::ZeroCrossingCounter, GRT::FIRFilter, GRT::ClassLabelFilter, GRT::LowPassFilter, GRT::HighPassFilter, GRT::MovementTrajectoryFeatures, GRT::Derivative, GRT::FFTFeatures, GRT::SavitzkyGolayFilter, GRT::KMeansFeatures, GRT::MovementIndex, GRT::DeadZone, GRT::ClassLabelChangeFilter, GRT::DoubleMovingAverageFilter, GRT::MedianFilter, GRT::MovingAverageFilter, GRT::TimeseriesBuffer, GRT::TimeDomainFeatures, GRT::PreProcessing, and GRT::PostProcessing.

Definition at line 135 of file MLBase.cpp.

bool GRT::MLBase::saveModelToFile ( fstream &  file) const
virtual
double GRT::MLBase::scale ( const double &  x,
const double &  minSource,
const double &  maxSource,
const double &  minTarget,
const double &  maxTarget,
const bool  constrain = false 
)
inline

Scales the input value x (which should be in the range [minSource maxSource]) to a value in the new target range of [minTarget maxTarget].

Parameters
constdouble &x: the value that should be scaled
constdouble &minSource: the minimum range that x originates from
constdouble &maxSource: the maximum range that x originates from
constdouble &minTarget: the minimum range that x should be scaled to
constdouble &maxTarget: the maximum range that x should be scaled to
constbool constrain: sets if the scaled value should be constrained to the target range
Returns
returns a new value that has been scaled based on the input parameters

Definition at line 339 of file MLBase.h.

bool GRT::MLBase::setLearningRate ( double  learningRate)

Sets the learningRate. This is used to update the weights at each step of learning algorithms such as stochastic gradient descent. The learningRate value must be greater than zero.

Parameters
doublelearningRate: the learningRate value used during the training phase, must be greater than zero
Returns
returns true if the value was updated successfully, false otherwise

Definition at line 260 of file MLBase.cpp.

bool GRT::MLBase::setMaxNumEpochs ( const UINT  maxNumEpochs)

Sets the maximum number of epochs (a complete iteration of all training samples) that can be run during the training phase. The maxNumIterations value must be greater than zero.

Parameters
constUINT maxNumIterations: the maximum number of iterations value, must be greater than zero
Returns
returns true if the value was updated successfully, false otherwise

Definition at line 237 of file MLBase.cpp.

bool GRT::MLBase::setMinChange ( const double  minChange)

Sets the minimum change that must be achieved between two training epochs for the training to continue. The minChange value must be greater than zero.

Parameters
constdouble minChange: the minimum change value, must be greater than zero
Returns
returns true if the value was updated successfully, false otherwise

Definition at line 251 of file MLBase.cpp.

bool GRT::MLBase::setMinNumEpochs ( const UINT  minNumEpochs)

Sets the minimum number of epochs (a complete iteration of all training samples) that can elapse with no change between two training epochs.

Parameters
constUINT minNumEpochs: the minimum number of epochs that can elapse with no change between two training epochs
Returns
returns true if the value was updated successfully, false otherwise

Definition at line 246 of file MLBase.cpp.

bool GRT::MLBase::setRandomiseTrainingOrder ( const bool  randomiseTrainingOrder)

Sets if the order of the training dataset should be randomized at each epoch of training. Randomizing the order of the training dataset stops a learning algorithm from focusing too much on the first few examples in the dataset.

Returns
returns true if the parameter was updated, false otherwise

Definition at line 285 of file MLBase.cpp.

bool GRT::MLBase::setUseValidationSet ( const bool  useValidationSet)

Sets the size of the validation set used by some learning algorithms for training. This value represents the percentage of the main dataset that will be used for training. For example, if the validationSetSize parameter is 20 then 20% of the training data will be used for a validation set leaving 80% of the original data to train the model.

Parameters
constUINT validationSetSize: the new validation set size (as a percentage)
Returns
returns true if the validationSetSize parameter was updated, false otherwise

Definition at line 280 of file MLBase.cpp.

bool GRT::MLBase::setValidationSetSize ( const UINT  validationSetSize)

Sets the size of the validation set used by some learning algorithms for training. This value represents the percentage of the main dataset that will be used for training. For example, if the validationSetSize parameter is 20 then 20% of the training data will be used for a validation set leaving 80% of the original data to train the model.

Parameters
constUINT validationSetSize: the new validation set size (as a percentage)
Returns
returns true if the validationSetSize parameter was updated, false otherwise

Definition at line 268 of file MLBase.cpp.

bool GRT::MLBase::train ( ClassificationData  trainingData)
virtual

This is the main training interface for ClassificationData. By default it will call the train_ function, unless it is overwritten by the derived class.

Parameters
ClassificationDatatrainingData: the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Reimplemented in GRT::LDA, and GRT::HMM.

Definition at line 80 of file MLBase.cpp.

bool GRT::MLBase::train ( RegressionData  trainingData)
virtual

This is the main training interface for regression data. By default it will call the train_ function, unless it is overwritten by the derived class.

Parameters
RegressionDatatrainingData: the training data that will be used to train a new regression model
Returns
returns true if a new regression model was trained, false otherwise

Definition at line 84 of file MLBase.cpp.

bool GRT::MLBase::train ( TimeSeriesClassificationData  trainingData)
virtual

This is the main training interface for TimeSeriesClassificationData. By default it will call the train_ function, unless it is overwritten by the derived class.

Parameters
TimeSeriesClassificationDatatrainingData: the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Definition at line 88 of file MLBase.cpp.

bool GRT::MLBase::train ( TimeSeriesClassificationDataStream  trainingData)
virtual

This is the main training interface for TimeSeriesClassificationDataStream. By default it will call the train_ function, unless it is overwritten by the derived class.

Parameters
TimeSeriesClassificationDataStreamtrainingData: the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Definition at line 92 of file MLBase.cpp.

bool GRT::MLBase::train ( UnlabelledData  trainingData)
virtual

This is the main training interface for UnlabelledData. By default it will call the train_ function, unless it is overwritten by the derived class.

Parameters
UnlabelledDatatrainingData: the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Definition at line 96 of file MLBase.cpp.

bool GRT::MLBase::train ( MatrixDouble  data)
virtual

This is the main training interface for MatrixDouble data. By default it will call the train_ function, unless it is overwritten by the derived class.

Parameters
MatrixDoubletrainingData: the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Definition at line 100 of file MLBase.cpp.

bool GRT::MLBase::train_ ( ClassificationData trainingData)
virtual

This is the main training interface for referenced ClassificationData. This should be overwritten by the derived class.

Parameters
ClassificationData&trainingData: a reference to the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::RBMQuantizer, GRT::SOMQuantizer, GRT::KMeansFeatures, GRT::KMeansQuantizer, GRT::KMeans, GRT::AdaBoost, GRT::SVM, GRT::KNN, GRT::GaussianMixtureModels, GRT::DecisionTree, GRT::ANBC, GRT::RandomForests, GRT::GMM, GRT::BAG, GRT::MinDist, GRT::Softmax, GRT::SwipeDetector, GRT::FiniteStateMachine, GRT::Clusterer, and GRT::MLP.

Definition at line 82 of file MLBase.cpp.

bool GRT::MLBase::train_ ( RegressionData trainingData)
virtual

This is the main training interface for all the regression algorithms. This should be overwritten by the derived class.

Parameters
RegressionDatatrainingData: the training data that will be used to train a new regression model
Returns
returns true if a new regression model was trained, false otherwise

Reimplemented in GRT::RegressionTree, GRT::MLP, GRT::MultidimensionalRegression, GRT::LinearRegression, and GRT::LogisticRegression.

Definition at line 86 of file MLBase.cpp.

bool GRT::MLBase::train_ ( TimeSeriesClassificationData trainingData)
virtual

This is the main training interface for referenced TimeSeriesClassificationData. This should be overwritten by the derived class.

Parameters
TimeSeriesClassificationData&trainingData: a reference to the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Reimplemented in GRT::RBMQuantizer, GRT::SOMQuantizer, GRT::KMeansFeatures, GRT::DTW, GRT::KMeansQuantizer, GRT::HMM, GRT::FiniteStateMachine, and GRT::ParticleClassifier.

Definition at line 90 of file MLBase.cpp.

bool GRT::MLBase::train_ ( TimeSeriesClassificationDataStream trainingData)
virtual

This is the main training interface for referenced TimeSeriesClassificationDataStream. This should be overwritten by the derived class.

Parameters
TimeSeriesClassificationDataStream&trainingData: a reference to the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Reimplemented in GRT::RBMQuantizer, GRT::SOMQuantizer, GRT::KMeansFeatures, GRT::KMeansQuantizer, and GRT::FiniteStateMachine.

Definition at line 94 of file MLBase.cpp.

bool GRT::MLBase::train_ ( UnlabelledData trainingData)
virtual

This is the main training interface for referenced UnlabelledData. This should be overwritten by the derived class.

Parameters
UnlabelledData&trainingData: a reference to the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::RBMQuantizer, GRT::SOMQuantizer, GRT::KMeansFeatures, GRT::KMeansQuantizer, GRT::KMeans, GRT::GaussianMixtureModels, and GRT::Clusterer.

Definition at line 98 of file MLBase.cpp.

bool GRT::MLBase::train_ ( MatrixDouble data)
virtual

This is the main training interface for referenced MatrixDouble data. This should be overwritten by the derived class.

Parameters
MatrixDouble&trainingData: a reference to the training data that will be used to train the ML model
Returns
returns true if the classifier was successfully trained, false otherwise

Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::RBMQuantizer, GRT::SOMQuantizer, GRT::KMeansFeatures, GRT::KMeansQuantizer, GRT::KMeans, GRT::GaussianMixtureModels, GRT::ClusterTree, GRT::BernoulliRBM, and GRT::Clusterer.

Definition at line 102 of file MLBase.cpp.


The documentation for this class was generated from the following files: