GestureRecognitionToolkit  Version: 0.2.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
UnlabelledData.h
Go to the documentation of this file.
1 
31 #ifndef GRT_UNLABLELLED_DATA_HEADER
32 #define GRT_UNLABLELLED_DATA_HEADER
33 
34 #include "../Util/GRTCommon.h"
35 
36 GRT_BEGIN_NAMESPACE
37 
38 class GRT_API UnlabelledData{
39 public:
40 
49  UnlabelledData(const UINT numDimensions = 0,const std::string datasetName = "NOT_SET",const std::string infoText = "");
50 
56  UnlabelledData(const UnlabelledData &rhs);
57 
61  ~UnlabelledData();
62 
69  UnlabelledData& operator= (const UnlabelledData &rhs);
70 
78  inline VectorFloat& operator[] (const UINT &i){
79  return data[i];
80  }
81 
89  const inline VectorFloat& operator[] (const UINT &i) const{
90  return data[i];
91  }
92 
96  void clear();
97 
108  bool setNumDimensions(const UINT numDimensions);
109 
118  bool setDatasetName(const std::string datasetName);
119 
127  bool setInfoText(const std::string infoText);
128 
136  bool addSample(const VectorFloat &sample);
137 
143  bool removeLastSample();
144 
153  bool reserve(const UINT N);
154 
163  bool setExternalRanges(const Vector< MinMax > &externalRanges, const bool useExternalRanges = false);
164 
172  bool enableExternalRangeScaling(const bool useExternalRanges);
173 
181  bool scale(const Float minTarget,const Float maxTarget);
182 
191  bool scale(const Vector<MinMax> &ranges,const Float minTarget,const Float maxTarget);
192 
201  bool save(const std::string &filename) const;
202 
211  bool load(const std::string &filename);
212 
219  bool saveDatasetToFile(const std::string &filename) const;
220 
227  bool loadDatasetFromFile(const std::string &filename);
228 
237  bool saveDatasetToCSVFile(const std::string &filename) const;
238 
248  bool loadDatasetFromCSVFile(const std::string &filename);
249 
255  GRT_DEPRECATED_MSG( "partition(...) is deprecated, use split(...) instead", UnlabelledData partition(const UINT partitionPercentage) );
256 
264  UnlabelledData split(const UINT partitionPercentage);
265 
273  bool merge(const UnlabelledData &unlabelledData);
274 
281  bool spiltDataIntoKFolds(const UINT K);
282 
290  UnlabelledData getTrainingFoldData(const UINT foldIndex) const;
291 
299  UnlabelledData getTestFoldData(const UINT foldIndex) const;
300 
306  std::string getDatasetName() const{ return datasetName; }
307 
313  std::string getInfoText() const{ return infoText; }
314 
320  std::string getStatsAsString() const;
321 
327  UINT inline getNumDimensions() const{ return numDimensions; }
328 
334  UINT inline getNumSamples() const{ return totalNumSamples; }
335 
341  Vector<MinMax> getRanges() const;
342 
348  Vector< VectorFloat > getData() const;
349 
355  MatrixDouble getDataAsMatrixDouble() const;
356 
362  MatrixFloat getDataAsMatrixFloat() const;
363 
364 private:
365  std::string datasetName;
366  std::string infoText;
367  UINT numDimensions;
368  UINT totalNumSamples;
369  UINT kFoldValue;
370  bool crossValidationSetup;
371  bool useExternalRanges;
372  Vector< MinMax > externalRanges;
373 
374  Vector< VectorFloat > data;
375  Vector< Vector< UINT > > crossValidationIndexs;
376 
377  DebugLog debugLog;
378  ErrorLog errorLog;
379  WarningLog warningLog;
380 
381 };
382 
383 GRT_END_NAMESPACE
384 
385 #endif //GRT_UNLABLELLED_CLASSIFICATION_DATA_HEADER
std::string getDatasetName() const
std::string getInfoText() const
UINT getNumDimensions() const
UINT getNumSamples() const