GestureRecognitionToolkit  Version: 0.1.0
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/GRTTypedefs.h"
36  #include "VectorFloat.h"
37 #include "RegressionSample.h"
38 
39 GRT_BEGIN_NAMESPACE
40 
42 public:
43 
53  RegressionData(const UINT numInputDimensions=0,const UINT numTargetDimensions=0,const std::string datasetName="NOT_SET",const std::string infoText="");
54 
60  RegressionData(const RegressionData &rhs);
61 
66 
74 
82  inline RegressionSample& operator[](const UINT &i){
83  return data[i];
84  }
85 
93  const inline RegressionSample& operator[](const UINT &i) const{
94  return data[i];
95  }
96 
100  void clear();
101 
113  bool setInputAndTargetDimensions(const UINT numInputDimensions,const UINT numTargetDimensions);
114 
123  bool setDatasetName(const std::string &datasetName);
124 
132  bool setInfoText(const std::string &infoText);
133 
142  bool addSample(const VectorFloat &inputVector,const VectorFloat &targetVector);
143 
149  bool removeLastSample();
150 
159  bool reserve(const UINT N);
160 
170  bool setExternalRanges(const Vector< MinMax > &externalInputRanges, const Vector< MinMax > &externalTargetRanges, const bool useExternalRanges);
171 
179  bool enableExternalRangeScaling(const bool useExternalRanges);
180 
188  bool scale(const Float minTarget,const Float maxTarget);
189 
195  bool scale(const Vector< MinMax > &inputVectorRanges,const Vector< MinMax > &targetVectorRanges,const Float minTarget,const Float maxTarget);
196 
205  bool save(const std::string &filename) const;
206 
215  bool load(const std::string &filename);
216 
223  bool saveDatasetToFile(const std::string &filename) const;
224 
231  bool loadDatasetFromFile(const std::string &filename);
232 
240  bool saveDatasetToCSVFile(const std::string &filename) const;
241 
252  bool loadDatasetFromCSVFile(const std::string &filename,const UINT numInputDimensions,const UINT numTargetDimensions);
253 
254  bool printStats() const;
255 
263  bool merge(const RegressionData &regressionData);
264 
272  RegressionData partition(const UINT trainingSizePercentage);
273 
280  bool spiltDataIntoKFolds(const UINT K);
281 
289  RegressionData getTrainingFoldData(const UINT foldIndex) const;
290 
298  RegressionData getTestFoldData(const UINT foldIndex) const;
299 
300  UINT removeDuplicateSamples();
301 
307  std::string getDatasetName()const { return datasetName; }
308 
314  std::string getInfoText() const { return infoText; }
315 
316  std::string getStatsAsString() const;
317 
323  UINT inline getNumInputDimensions() const{ return numInputDimensions; }
324 
330  UINT inline getNumTargetDimensions() const{ return numTargetDimensions; }
331 
337  UINT inline getNumSamples() const{ return totalNumSamples; }
338 
345 
352 
358  Vector< RegressionSample > getData() const{ return data; }
359 
360 private:
361  std::string datasetName;
362  std::string infoText;
363  UINT numInputDimensions;
364  UINT numTargetDimensions;
365  UINT totalNumSamples;
366  UINT kFoldValue;
367  bool crossValidationSetup;
368  bool useExternalRanges;
369  Vector< MinMax > externalInputRanges;
370  Vector< MinMax > externalTargetRanges;
372  Vector< Vector< UINT > > crossValidationIndexs;
373 
374  DebugLog debugLog;
375  ErrorLog errorLog;
376  WarningLog warningLog;
377 };
378 
379 GRT_END_NAMESPACE
380 
381 #endif //GRT_REGRESSION_DATA_HEADER
382 
bool merge(const RegressionData &regressionData)
bool loadDatasetFromCSVFile(const std::string &filename, const UINT numInputDimensions, const UINT numTargetDimensions)
bool save(const std::string &filename) const
Vector< MinMax > getInputRanges() const
std::string getDatasetName() const
RegressionData & operator=(const RegressionData &rhs)
bool load(const std::string &filename)
RegressionData getTrainingFoldData(const UINT foldIndex) const
bool setInfoText(const std::string &infoText)
UINT getNumInputDimensions() const
bool setExternalRanges(const Vector< MinMax > &externalInputRanges, const Vector< MinMax > &externalTargetRanges, const bool useExternalRanges)
const RegressionSample & operator[](const UINT &i) const
bool setInputAndTargetDimensions(const UINT numInputDimensions, const UINT numTargetDimensions)
Vector< MinMax > getTargetRanges() const
bool scale(const Float minTarget, const Float maxTarget)
UINT getNumTargetDimensions() const
RegressionData(const UINT numInputDimensions=0, const UINT numTargetDimensions=0, const std::string datasetName="NOT_SET", const std::string infoText="")
bool saveDatasetToCSVFile(const std::string &filename) const
This class stores the input vector and target vector for a single labelled regression instance...
bool setDatasetName(const std::string &datasetName)
bool saveDatasetToFile(const std::string &filename) const
Vector< RegressionSample > getData() const
RegressionSample & operator[](const UINT &i)
RegressionData getTestFoldData(const UINT foldIndex) const
bool loadDatasetFromFile(const std::string &filename)
bool enableExternalRangeScaling(const bool useExternalRanges)
RegressionData partition(const UINT trainingSizePercentage)
bool addSample(const VectorFloat &inputVector, const VectorFloat &targetVector)
bool reserve(const UINT N)
std::string getInfoText() const
bool spiltDataIntoKFolds(const UINT K)
UINT getNumSamples() const