![]() |
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.
|
Public Types | |
typedef std::map< string, Clusterer *(*)() > | StringClustererMap |
![]() | |
enum | BaseTypes { BASE_TYPE_NOT_SET =0, CLASSIFIER, REGRESSIFIER, CLUSTERER } |
Public Member Functions | |
Clusterer (void) | |
virtual | ~Clusterer (void) |
virtual bool | deepCopyFrom (const Clusterer *Clusterer) |
bool | copyBaseVariables (const Clusterer *Clusterer) |
virtual bool | train_ (MatrixDouble &trainingData) |
virtual bool | train_ (ClassificationData &trainingData) |
virtual bool | train_ (UnlabelledData &trainingData) |
virtual bool | reset () |
virtual bool | clear () |
bool | getConverged () const |
UINT | getNumClusters () const |
UINT | getPredictedClusterLabel () const |
double | getMaximumLikelihood () const |
double | getBestDistance () const |
VectorDouble | getClusterLikelihoods () const |
VectorDouble | getClusterDistances () const |
vector< UINT > | getClusterLabels () const |
string | getClustererType () const |
bool | setNumClusters (const UINT numClusters) |
Clusterer * | createNewInstance () const |
Clusterer * | deepCopy () const |
const Clusterer & | getBaseClusterer () const |
![]() | |
MLBase (void) | |
virtual | ~MLBase (void) |
bool | copyMLBaseVariables (const MLBase *mlBase) |
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 (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 | 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) |
MLBase * | getMLBasePointer () |
const MLBase * | getMLBasePointer () const |
vector< TrainingResult > | getTrainingResults () const |
![]() | |
GRTBase (void) | |
virtual | ~GRTBase (void) |
bool | copyGRTBaseVariables (const GRTBase *GRTBase) |
string | getClassType () const |
string | getLastWarningMessage () const |
string | getLastErrorMessage () const |
string | getLastInfoMessage () const |
GRTBase * | getGRTBasePointer () |
const GRTBase * | getGRTBasePointer () const |
![]() | |
virtual void | notify (const TrainingResult &data) |
![]() | |
virtual void | notify (const TestInstanceResult &data) |
Static Public Member Functions | |
static Clusterer * | createInstanceFromString (string const &ClustererType) |
static vector< string > | getRegisteredClusterers () |
![]() | |
static string | getGRTVersion (bool returnRevision=true) |
static string | getGRTRevison () |
Protected Member Functions | |
bool | saveClustererSettingsToFile (fstream &file) const |
bool | loadClustererSettingsFromFile (fstream &file) |
![]() | |
bool | saveBaseSettingsToFile (fstream &file) const |
bool | loadBaseSettingsFromFile (fstream &file) |
![]() | |
double | SQR (const double &x) const |
Static Protected Member Functions | |
static StringClustererMap * | getMap () |
Protected Attributes | |
string | clustererType |
UINT | numClusters |
Number of clusters in the model. | |
UINT | predictedClusterLabel |
Stores the predicted cluster label from the most recent predict( ) | |
double | maxLikelihood |
double | bestDistance |
VectorDouble | clusterLikelihoods |
VectorDouble | clusterDistances |
vector< UINT > | clusterLabels |
bool | converged |
vector< MinMax > | ranges |
![]() | |
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< TrainingResult > | trainingResults |
TrainingResultsObserverManager | trainingResultsObserverManager |
TestResultsObserverManager | testResultsObserverManager |
![]() | |
string | classType |
DebugLog | debugLog |
ErrorLog | errorLog |
InfoLog | infoLog |
TrainingLog | trainingLog |
TestingLog | testingLog |
WarningLog | warningLog |
Definition at line 38 of file Clusterer.h.
typedef std::map< string, Clusterer*(*)() > GRT::Clusterer::StringClustererMap |
Defines a map between a string (which will contain the name of the Clusterer, such as KMeans) and a function returns a new instance of that Clusterer
Definition at line 190 of file Clusterer.h.
GRT::Clusterer::Clusterer | ( | void | ) |
Default Clusterer Constructor
Definition at line 63 of file Clusterer.cpp.
|
virtual |
Default Clusterer Destructor
Definition at line 77 of file Clusterer.cpp.
|
virtual |
This function clears the Clusterer module, removing any trained model and setting all the base variables to their default values.
Reimplemented from GRT::MLBase.
Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::ClusterTree, GRT::KMeans, and GRT::GaussianMixtureModels.
Definition at line 139 of file Clusterer.cpp.
bool GRT::Clusterer::copyBaseVariables | ( | const Clusterer * | Clusterer | ) |
This copies the Clusterer base class variables from the Clusterer pointer to this instance.
const | Clusterer *Clusterer: a pointer to a Clusterer from which the values will be copied to this instance |
Definition at line 84 of file Clusterer.cpp.
|
static |
Creates a new Clusterer instance based on the input string (which should contain the name of a valid Clusterer such as KMeans).
string | const &ClustererType: the name of the Clusterer |
Definition at line 27 of file Clusterer.cpp.
Clusterer * GRT::Clusterer::createNewInstance | ( | ) | const |
Creates a new Clusterer instance based on the current clustererType string value.
Definition at line 35 of file Clusterer.cpp.
Clusterer * GRT::Clusterer::deepCopy | ( | ) | const |
This creates a new Clusterer instance and deep copies the variables and models from this instance into the deep copy. The function will then return a pointer to the new instance. It is up to the user who calls this function to delete the dynamic instance when they are finished using it.
Definition at line 39 of file Clusterer.cpp.
|
inlinevirtual |
This is the base deep copy function for the Clusterer modules. This function should be overwritten by the derived class. This deep copies the variables and models from the Clusterer pointer to this Clusterer instance.
const | Clusterer *Clusterer: a pointer to the Clusterer base class, this should be pointing to another instance of a matching derived class |
Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::ClusterTree, GRT::KMeans, and GRT::GaussianMixtureModels.
Definition at line 58 of file Clusterer.h.
const Clusterer & GRT::Clusterer::getBaseClusterer | ( | ) | const |
double GRT::Clusterer::getBestDistance | ( | ) | const |
Returns the current bestDistance value. The bestDistance value is computed during the prediction phase and is either the minimum or maximum distance, depending on the algorithm. This value will return 0 if a prediction has not been made.
Definition at line 241 of file Clusterer.cpp.
VectorDouble GRT::Clusterer::getClusterDistances | ( | ) | const |
Gets a vector of the cluster distances from the last prediction, this will be an N-dimensional vector, where N is the number of clusters in the model. The exact form of these distances depends on the cluster algorithm.
Definition at line 249 of file Clusterer.cpp.
string GRT::Clusterer::getClustererType | ( | ) | const |
Returns the classifeir type as a string.
Definition at line 257 of file Clusterer.cpp.
vector< UINT > GRT::Clusterer::getClusterLabels | ( | ) | const |
Gets a vector of unsigned ints containing the label of each cluster, this will be an K-dimensional vector, where K is the number of clusters in the model.
Definition at line 253 of file Clusterer.cpp.
VectorDouble GRT::Clusterer::getClusterLikelihoods | ( | ) | const |
Gets a vector of the cluster likelihoods from the last prediction, this will be an N-dimensional vector, where N is the number of clusters in the model. The exact form of these likelihoods depends on the cluster algorithm.
Definition at line 245 of file Clusterer.cpp.
bool GRT::Clusterer::getConverged | ( | ) | const |
Returns true if the training algorithm converged during the most recent training process. This function will return false if the model has not been trained.
Definition at line 227 of file Clusterer.cpp.
double GRT::Clusterer::getMaximumLikelihood | ( | ) | const |
Returns the current maximumLikelihood value. The maximumLikelihood value is computed during the prediction phase and is the likelihood of the most likely model. This value will return 0 if a prediction has not been made.
Definition at line 237 of file Clusterer.cpp.
UINT GRT::Clusterer::getNumClusters | ( | ) | const |
Returns the number of clusters in the model.
Definition at line 232 of file Clusterer.cpp.
UINT GRT::Clusterer::getPredictedClusterLabel | ( | ) | const |
Returns the predicted cluster label.
Definition at line 234 of file Clusterer.cpp.
|
static |
Returns a vector of the names of all Clusterers that have been registered with the base Clusterer.
Definition at line 52 of file Clusterer.cpp.
|
protected |
Loads the core clusterer settings from a file.
Definition at line 176 of file Clusterer.cpp.
|
virtual |
This resets the Clusterer. This overrides the reset function in the MLBase base class.
Reimplemented from GRT::MLBase.
Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::KMeans, and GRT::GaussianMixtureModels.
Definition at line 125 of file Clusterer.cpp.
|
protected |
Saves the core clusterer settings to a file.
Definition at line 154 of file Clusterer.cpp.
bool GRT::Clusterer::setNumClusters | ( | const UINT | numClusters | ) |
Sets the number of clusters that will be used the next time a model is trained. This will clear any previous model. The number of clusters must be greater than zero.
UINT | numClusters: the number of clusters, must be greater than zero |
Definition at line 263 of file Clusterer.cpp.
|
virtual |
This is the main interface for training the clusterer model.
MatrixDouble | &trainingData: a reference to the training data that will be used to train the ML model |
Reimplemented from GRT::MLBase.
Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::KMeans, GRT::GaussianMixtureModels, and GRT::ClusterTree.
Definition at line 111 of file Clusterer.cpp.
|
virtual |
Override the main ClassificationData train function to pass MatrixDouble data to the Clusterer train function.
ClassificationData | &trainingData: a reference to the training data that will be used to train the ML model |
Reimplemented from GRT::MLBase.
Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::KMeans, and GRT::GaussianMixtureModels.
Definition at line 115 of file Clusterer.cpp.
|
virtual |
Override the main UnlabelledData train function to pass MatrixDouble data to the Clusterer train function.
UnlabelledData | &trainingData: a reference to the training data that will be used to train the ML model |
Reimplemented from GRT::MLBase.
Reimplemented in GRT::SelfOrganizingMap, GRT::HierarchicalClustering, GRT::KMeans, and GRT::GaussianMixtureModels.
Definition at line 120 of file Clusterer.cpp.