![]() |
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 Member Functions | |
UnlabelledData (const UINT numDimensions=0, const string datasetName="NOT_SET", const string infoText="") | |
UnlabelledData (const UnlabelledData &rhs) | |
~UnlabelledData () | |
UnlabelledData & | operator= (const UnlabelledData &rhs) |
VectorDouble & | operator[] (const UINT &i) |
const VectorDouble & | operator[] (const UINT &i) const |
void | clear () |
bool | setNumDimensions (const UINT numDimensions) |
bool | setDatasetName (const string datasetName) |
bool | setInfoText (const string infoText) |
bool | addSample (const VectorDouble &sample) |
bool | removeLastSample () |
bool | reserve (const UINT N) |
bool | setExternalRanges (const vector< MinMax > &externalRanges, const bool useExternalRanges=false) |
bool | enableExternalRangeScaling (const bool useExternalRanges) |
bool | scale (const double minTarget, const double maxTarget) |
bool | scale (const vector< MinMax > &ranges, const double minTarget, const double maxTarget) |
bool | save (const string &filename) const |
bool | load (const string &filename) |
bool | saveDatasetToFile (const string &filename) const |
bool | loadDatasetFromFile (const string &filename) |
bool | saveDatasetToCSVFile (const string &filename) const |
bool | loadDatasetFromCSVFile (const string &filename) |
UnlabelledData | partition (const UINT partitionPercentage) |
bool | merge (const UnlabelledData &unlabelledData) |
bool | spiltDataIntoKFolds (const UINT K) |
UnlabelledData | getTrainingFoldData (const UINT foldIndex) const |
UnlabelledData | getTestFoldData (const UINT foldIndex) const |
string | getDatasetName () const |
string | getInfoText () const |
string | getStatsAsString () const |
UINT | getNumDimensions () const |
UINT | getNumSamples () const |
vector< MinMax > | getRanges () const |
vector< VectorDouble > | getData () const |
MatrixDouble | getDataAsMatrixDouble () const |
Definition at line 38 of file UnlabelledData.h.
GRT::UnlabelledData::UnlabelledData | ( | const UINT | numDimensions = 0 , |
const string | datasetName = "NOT_SET" , |
||
const string | infoText = "" |
||
) |
Constructor, sets the name of the dataset and the number of dimensions of the training data. The name of the dataset should not contain any spaces.
UINT | numDimensions: the number of dimensions of the training data, should be an unsigned integer greater than 0 |
string | datasetName: the name of the dataset, should not contain any spaces |
string | infoText: some info about the data in this dataset, this can contain spaces |
Definition at line 25 of file UnlabelledData.cpp.
GRT::UnlabelledData::UnlabelledData | ( | const UnlabelledData & | rhs | ) |
Copy Constructor, copies the UnlabelledData from the rhs instance to this instance
const | UnlabelledData &rhs: another instance of the UnlabelledData class from which the data will be copied to this instance |
Definition at line 35 of file UnlabelledData.cpp.
GRT::UnlabelledData::~UnlabelledData | ( | ) |
Default Destructor
Definition at line 39 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::addSample | ( | const VectorDouble & | sample | ) |
Adds a new unlabelled sample to the dataset. The dimensionality of the sample should match the number of dimensions in the UnlabelledData.
const | VectorDouble &sample: the new sample you want to add to the dataset. The dimensionality of this sample should match the number of dimensions in the UnlabelledData |
Definition at line 101 of file UnlabelledData.cpp.
void GRT::UnlabelledData::clear | ( | ) |
Clears any previous training data and counters
Definition at line 60 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::enableExternalRangeScaling | ( | const bool | useExternalRanges | ) |
Sets if the dataset should be scaled using an external range (if useExternalRanges == true) or the ranges of the dataset (if false). The external ranges need to be set FIRST before calling this function, otherwise it will return false.
bool | useExternalRanges: sets if these ranges should be used to scale the dataset |
Definition at line 156 of file UnlabelledData.cpp.
vector< VectorDouble > GRT::UnlabelledData::getData | ( | ) | const |
Gets the unlabeled classification data as a vector of VectorDoubles.
Definition at line 639 of file UnlabelledData.cpp.
MatrixDouble GRT::UnlabelledData::getDataAsMatrixDouble | ( | ) | const |
Gets the unlabeled classification data as a MatrixDouble.
Definition at line 643 of file UnlabelledData.cpp.
|
inline |
Gets the name of the dataset.
Definition at line 293 of file UnlabelledData.h.
|
inline |
Gets the infotext for the dataset
Definition at line 300 of file UnlabelledData.h.
|
inline |
Gets the number of dimensions of the labelled classification data.
Definition at line 314 of file UnlabelledData.h.
|
inline |
Gets the number of samples in the classification data across all the classes.
Definition at line 321 of file UnlabelledData.h.
vector< MinMax > GRT::UnlabelledData::getRanges | ( | ) | const |
Gets the ranges of the classification data.
Definition at line 618 of file UnlabelledData.cpp.
string GRT::UnlabelledData::getStatsAsString | ( | ) | const |
Gets the stats of the dataset as a string
Definition at line 601 of file UnlabelledData.cpp.
UnlabelledData GRT::UnlabelledData::getTestFoldData | ( | const UINT | foldIndex | ) | const |
Returns the test dataset for the k-th fold for cross validation. The spiltDataIntoKFolds(UINT K) function should have been called once before using this function. The foldIndex should be in the range [0 K-1], where K is the number of folds the data was spilt into.
const | UINT foldIndex: the index of the fold you want the test data for, this should be in the range [0 K-1], where K is the number of folds the data was spilt into |
Definition at line 576 of file UnlabelledData.cpp.
UnlabelledData GRT::UnlabelledData::getTrainingFoldData | ( | const UINT | foldIndex | ) | const |
Returns the training dataset for the k-th fold for cross validation. The spiltDataIntoKFolds(UINT K) function should have been called once before using this function. The foldIndex should be in the range [0 K-1], where K is the number of folds the data was spilt into.
const | UINT foldIndex: the index of the fold you want the training data for, this should be in the range [0 K-1], where K is the number of folds the data was spilt into |
Definition at line 540 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::load | ( | const string & | filename | ) |
Load the data from a file. If the file format ends in '.csv' then the function will try and load the data from a csv format. If this fails then it will try and load the data as a custom GRT file.
const | string &filename: the name of the file the data will be loaded from |
Definition at line 193 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::loadDatasetFromCSVFile | ( | const string & | filename | ) |
Loads the unlabelled classification data from a CSV file. This assumes the data is formatted with each row representing a sample. The sample data should be formatted as N columns, where N is the number of dimensions in the data. Each row should represent a sample
const | string &filename: the name of the file the data will be loaded from |
Definition at line 366 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::loadDatasetFromFile | ( | const string & | filename | ) |
Loads the unlabeled classification data from a custom file format.
const | string &filename: the name of the file the data will be loaded from |
Definition at line 242 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::merge | ( | const UnlabelledData & | unlabelledData | ) |
Adds the data in the unlabelledData set to the current instance of the UnlabelledData. The number of dimensions in both datasets must match.
UnlabelledData | &unlabelledData: the dataset to add to this dataset |
Definition at line 460 of file UnlabelledData.cpp.
UnlabelledData & GRT::UnlabelledData::operator= | ( | const UnlabelledData & | rhs | ) |
Sets the equals operator, copies the data from the rhs instance to this instance
const | UnlabelledData &rhs: another instance of the UnlabelledData class from which the data will be copied to this instance |
Definition at line 41 of file UnlabelledData.cpp.
|
inline |
Array Subscript Operator, returns the UnlabelledData at index i. It is up to the user to ensure that i is within the range of [0 totalNumSamples-1]
const | UINT &i: the index of the training sample you want to access. Must be within the range of [0 totalNumSamples-1] |
Definition at line 78 of file UnlabelledData.h.
|
inline |
Array Subscript Operator, returns the const UnlabelledData at index i. It is up to the user to ensure that i is within the range of [0 totalNumSamples-1]
const | UINT &i: the index of the training sample you want to access. Must be within the range of [0 totalNumSamples-1] |
Definition at line 89 of file UnlabelledData.h.
UnlabelledData GRT::UnlabelledData::partition | ( | const UINT | partitionPercentage | ) |
Partitions the dataset into a training dataset (which is kept by this instance of the UnlabelledData) and a testing/validation dataset (which is returned as a new instance of a UnlabelledData).
UINT | partitionPercentage: sets the percentage of data which remains in this instance, the remaining percentage of data is then returned as the testing/validation dataset |
Definition at line 414 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::removeLastSample | ( | ) |
Removes the last training sample added to the dataset.
Definition at line 115 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::reserve | ( | const UINT | N | ) |
Reserves that the vector capacity be at least enough to contain N elements.
If N is greater than the current vector capacity, the function causes the container to reallocate its storage increasing its capacity to N (or greater).
const | UINT N: the new memory size |
Definition at line 137 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::save | ( | const string & | filename | ) | const |
Saves the data to a file. If the file format ends in '.csv' then the data will be saved as comma-seperated-values, otherwise it will be saved to a custom GRT file (which contains the csv data with an additional header).
const | string &filename: the name of the file the data will be saved to |
Definition at line 182 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::saveDatasetToCSVFile | ( | const string & | filename | ) | const |
Saves the unlabeled classification data to a CSV file. This will save the sample data as N columns, where N is the number of dimensions in the data. Each row will represent a sample.
const | string &filename: the name of the file the data will be saved to |
Definition at line 342 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::saveDatasetToFile | ( | const string & | filename | ) | const |
Saves the unlabeled classification data to a custom file format.
const | string &filenamee: the name of the file the data will be saved to |
Definition at line 204 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::scale | ( | const double | minTarget, |
const double | maxTarget | ||
) |
Scales the dataset to the new target range.
Definition at line 164 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::scale | ( | const vector< MinMax > & | ranges, |
const double | minTarget, | ||
const double | maxTarget | ||
) |
Scales the dataset to the new target range, using the vector of ranges as the min and max source ranges.
Definition at line 169 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::setDatasetName | ( | const string | datasetName | ) |
Sets the name of the dataset. There should not be any spaces in the name. Will return true if the name is set, or false otherwise.
Definition at line 85 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::setExternalRanges | ( | const vector< MinMax > & | externalRanges, |
const bool | useExternalRanges = false |
||
) |
Sets the external ranges of the dataset, also sets if the dataset should be scaled using these values. The dimensionality of the externalRanges vector should match the number of dimensions of this dataset.
vector< | MinMax > externalRanges: an N dimensional vector containing the min and max values of the expected ranges of the dataset. |
bool | useExternalRanges: sets if these ranges should be used to scale the dataset, default value is false. |
Definition at line 146 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::setInfoText | ( | const string | infoText | ) |
Sets the info string. This can be any string with information about how the training data was recorded for example.
string | infoText: the infoText |
Definition at line 96 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::setNumDimensions | ( | const UINT | numDimensions | ) |
Sets the number of dimensions in the training data. This should be an unsigned integer greater than zero. This will clear any previous training data and counters. This function needs to be called before any new samples can be added to the dataset, unless the numDimensions variable was set in the constructor or some data was already loaded from a file
UINT | numDimensions: the number of dimensions of the training data. Must be an unsigned integer greater than zero |
Definition at line 67 of file UnlabelledData.cpp.
bool GRT::UnlabelledData::spiltDataIntoKFolds | ( | const UINT | K | ) |
This function prepares the dataset for k-fold cross validation and should be called prior to calling the getTrainingFold(UINT foldIndex) or getTestingFold(UINT foldIndex) functions. It will spilt the dataset into K-folds, as long as K < M, where M is the number of samples in the dataset.
const | UINT K: the number of folds the dataset will be split into, K should be less than the number of samples in the dataset |
Definition at line 481 of file UnlabelledData.cpp.