GestureRecognitionToolkit  Version: 0.2.5
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 
41 class GRT_API RegressionData{
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 
65  ~RegressionData();
66 
73  RegressionData& operator=(const RegressionData &rhs);
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 
270  GRT_DEPRECATED_MSG( "partition(...) is deprecated, use split(...) instead", RegressionData partition(const UINT trainingSizePercentage) );
271 
279  RegressionData split(const UINT trainingSizePercentage);
280 
287  bool spiltDataIntoKFolds(const UINT K);
288 
296  RegressionData getTrainingFoldData(const UINT foldIndex) const;
297 
305  RegressionData getTestFoldData(const UINT foldIndex) const;
306 
307  UINT removeDuplicateSamples();
308 
314  std::string getDatasetName()const { return datasetName; }
315 
321  std::string getInfoText() const { return infoText; }
322 
323  std::string getStatsAsString() const;
324 
330  UINT inline getNumInputDimensions() const{ return numInputDimensions; }
331 
337  UINT inline getNumTargetDimensions() const{ return numTargetDimensions; }
338 
344  UINT inline getNumSamples() const{ return totalNumSamples; }
345 
351  Vector<MinMax> getInputRanges() const;
352 
358  Vector<MinMax> getTargetRanges() const;
359 
365  Vector< RegressionSample > getData() const{ return data; }
366 
367 private:
368  std::string datasetName;
369  std::string infoText;
370  UINT numInputDimensions;
371  UINT numTargetDimensions;
372  UINT totalNumSamples;
373  UINT kFoldValue;
374  bool crossValidationSetup;
375  bool useExternalRanges;
376  Vector< MinMax > externalInputRanges;
377  Vector< MinMax > externalTargetRanges;
379  Vector< Vector< UINT > > crossValidationIndexs;
380 
381  DebugLog debugLog;
382  ErrorLog errorLog;
383  WarningLog warningLog;
384 };
385 
386 GRT_END_NAMESPACE
387 
388 #endif //GRT_REGRESSION_DATA_HEADER
389 
std::string getDatasetName() const
UINT getNumInputDimensions() const
const RegressionSample & operator[](const UINT &i) const
UINT getNumTargetDimensions() const
This class stores the input vector and target vector for a single labelled regression instance...
Vector< RegressionSample > getData() const
RegressionSample & operator[](const UINT &i)
std::string getInfoText() const
UINT getNumSamples() const