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.
RegressionData.h
Go to the documentation of this file.
1 
32 #ifndef GRT_REGRESSION_DATA_HEADER
33 #define GRT_REGRESSION_DATA_HEADER
34 
35 #include "../Util/GRTCommon.h"
36 #include "RegressionSample.h"
37 
38 namespace GRT{
39 
41 public:
42 
52  RegressionData(const UINT numInputDimensions=0,const UINT numTargetDimensions=0,const string datasetName="NOT_SET",const string infoText="");
53 
59  RegressionData(const RegressionData &rhs);
60 
65 
73 
81  inline RegressionSample& operator[](const UINT &i){
82  return data[i];
83  }
84 
92  const inline RegressionSample& operator[](const UINT &i) const{
93  return data[i];
94  }
95 
99  void clear();
100 
112  bool setInputAndTargetDimensions(const UINT numInputDimensions,const UINT numTargetDimensions);
113 
122  bool setDatasetName(const string &datasetName);
123 
131  bool setInfoText(const string &infoText);
132 
141  bool addSample(const VectorDouble &inputVector,const VectorDouble &targetVector);
142 
148  bool removeLastSample();
149 
158  bool reserve(const UINT N);
159 
169  bool setExternalRanges(const vector< MinMax > &externalInputRanges, const vector< MinMax > &externalTargetRanges, const bool useExternalRanges);
170 
178  bool enableExternalRangeScaling(const bool useExternalRanges);
179 
187  bool scale(const double minTarget,const double maxTarget);
188 
194  bool scale(const vector< MinMax > &inputVectorRanges,const vector< MinMax > &targetVectorRanges,const double minTarget,const double maxTarget);
195 
204  bool save(const string &filename) const;
205 
214  bool load(const string &filename);
215 
222  bool saveDatasetToFile(const string &filename) const;
223 
230  bool loadDatasetFromFile(const string &filename);
231 
239  bool saveDatasetToCSVFile(const string &filename) const;
240 
251  bool loadDatasetFromCSVFile(const string &filename,const UINT numInputDimensions,const UINT numTargetDimensions);
252 
253  bool printStats() const;
254 
262  bool merge(const RegressionData &regressionData);
263 
271  RegressionData partition(const UINT trainingSizePercentage);
272 
279  bool spiltDataIntoKFolds(const UINT K);
280 
288  RegressionData getTrainingFoldData(const UINT foldIndex) const;
289 
297  RegressionData getTestFoldData(const UINT foldIndex) const;
298 
299  UINT removeDuplicateSamples();
300 
306  string getDatasetName()const { return datasetName; }
307 
313  string getInfoText() const { return infoText; }
314 
315  string getStatsAsString() const;
316 
322  UINT inline getNumInputDimensions() const{ return numInputDimensions; }
323 
329  UINT inline getNumTargetDimensions() const{ return numTargetDimensions; }
330 
336  UINT inline getNumSamples() const{ return totalNumSamples; }
337 
343  vector<MinMax> getInputRanges() const;
344 
350  vector<MinMax> getTargetRanges() const;
351 
357  vector< RegressionSample > getData() const{ return data; }
358 
359 private:
360  string datasetName;
361  string infoText;
362  UINT numInputDimensions;
363  UINT numTargetDimensions;
364  UINT totalNumSamples;
365  UINT kFoldValue;
366  bool crossValidationSetup;
367  bool useExternalRanges;
368  vector< MinMax > externalInputRanges;
369  vector< MinMax > externalTargetRanges;
370  vector< RegressionSample > data;
371  vector< vector< UINT > > crossValidationIndexs;
372 
373  DebugLog debugLog;
374  ErrorLog errorLog;
375  WarningLog warningLog;
376 };
377 
378 } //End of namespace GRT
379 
380 #endif //GRT_REGRESSION_DATA_HEADER
381 
bool saveDatasetToCSVFile(const string &filename) const
RegressionSample & operator[](const UINT &i)
bool loadDatasetFromCSVFile(const string &filename, const UINT numInputDimensions, const UINT numTargetDimensions)
string getDatasetName() const
string getInfoText() const
bool enableExternalRangeScaling(const bool useExternalRanges)
Definition: AdaBoost.cpp:25
bool setInfoText(const string &infoText)
bool loadDatasetFromFile(const string &filename)
bool setInputAndTargetDimensions(const UINT numInputDimensions, const UINT numTargetDimensions)
bool load(const string &filename)
vector< MinMax > getInputRanges() const
bool reserve(const UINT N)
UINT getNumSamples() const
const RegressionSample & operator[](const UINT &i) const
bool setExternalRanges(const vector< MinMax > &externalInputRanges, const vector< MinMax > &externalTargetRanges, const bool useExternalRanges)
bool saveDatasetToFile(const string &filename) const
RegressionData getTrainingFoldData(const UINT foldIndex) const
This class stores the input vector and target vector for a single labelled regression instance...
vector< MinMax > getTargetRanges() const
RegressionData & operator=(const RegressionData &rhs)
bool merge(const RegressionData &regressionData)
vector< RegressionSample > getData() const
bool spiltDataIntoKFolds(const UINT K)
bool save(const string &filename) const
RegressionData(const UINT numInputDimensions=0, const UINT numTargetDimensions=0, const string datasetName="NOT_SET", const string infoText="")
RegressionData partition(const UINT trainingSizePercentage)
UINT getNumTargetDimensions() const
bool addSample(const VectorDouble &inputVector, const VectorDouble &targetVector)
bool setDatasetName(const string &datasetName)
UINT getNumInputDimensions() const
RegressionData getTestFoldData(const UINT foldIndex) const
bool scale(const double minTarget, const double maxTarget)