ESP  0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
ThresholdDetection.h
Go to the documentation of this file.
1 
29 #ifndef GRT_THRESHOLD_DETECTION_HEADER
30 #define GRT_THRESHOLD_DETECTION_HEADER
31 
32 #include "GRT/CoreModules/FeatureExtraction.h"
33 #include "GRT/Util/Util.h"
34 
35 namespace GRT{
36 
37 class ThresholdDetection : public FeatureExtraction{
38 public:
41  ThresholdDetection(UINT bufferLength=100,UINT numDimensions = 1,double alpha=4.0,double beta=1.2);
42 
49 
53  virtual ~ThresholdDetection();
54 
62 
71  virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction);
72 
81  virtual bool computeFeatures(const VectorDouble &inputVector);
82 
90  virtual bool reset();
91 
98  virtual bool saveModelToFile(string filename) const;
99 
106  virtual bool loadModelFromFile(string filename);
107 
115  virtual bool saveModelToFile(fstream &file) const;
116 
124  virtual bool loadModelFromFile(fstream &file);
125 
129  bool init(UINT bufferLength,UINT numDimensions,double alpha,double beta);
130 
137  VectorDouble update(double x);
138 
145  VectorDouble update(const VectorDouble &x);
146 
152  CircularBuffer< VectorDouble > getBufferData();
153 
159  const CircularBuffer< VectorDouble > &getBufferData() const;
160 
161  //Tell the compiler we are using the following functions from the MLBase class to stop hidden virtual function warnings
162  using MLBase::train;
163  using MLBase::train_;
164  using MLBase::predict;
165  using MLBase::predict_;
166 
167 protected:
169  CircularBuffer< VectorDouble > dataBuffer;
170  double alpha, beta;
171  bool inNoise;
172 
173  static RegisterFeatureExtractionModule< ThresholdDetection > registerModule;
174 };
175 
176 }//End of namespace GRT
177 
178 #endif //GRT_THRESHOLD_DETECTION_HEADER
CircularBuffer< VectorDouble > getBufferData()
Definition: ThresholdDetection.cpp:308
VectorDouble update(double x)
Definition: ThresholdDetection.cpp:239
virtual bool computeFeatures(const VectorDouble &inputVector)
Definition: ThresholdDetection.cpp:85
ThresholdDetection & operator=(const ThresholdDetection &rhs)
Definition: ThresholdDetection.cpp:55
virtual bool loadModelFromFile(string filename)
Definition: ThresholdDetection.cpp:123
UINT bufferLength
Definition: ThresholdDetection.h:168
virtual bool reset()
Definition: ThresholdDetection.cpp:102
Definition: Filter.cpp:23
virtual ~ThresholdDetection()
Definition: ThresholdDetection.cpp:51
double beta
Definition: ThresholdDetection.h:170
Definition: ThresholdDetection.h:37
virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction)
Definition: ThresholdDetection.cpp:68
bool inNoise
Definition: ThresholdDetection.h:171
bool init(UINT bufferLength, UINT numDimensions, double alpha, double beta)
Definition: ThresholdDetection.cpp:212
static RegisterFeatureExtractionModule< ThresholdDetection > registerModule
Definition: ThresholdDetection.h:173
CircularBuffer< VectorDouble > dataBuffer
Definition: ThresholdDetection.h:169
virtual bool saveModelToFile(string filename) const
Definition: ThresholdDetection.cpp:109
ThresholdDetection(UINT bufferLength=100, UINT numDimensions=1, double alpha=4.0, double beta=1.2)
Definition: ThresholdDetection.cpp:28
double alpha
Definition: ThresholdDetection.h:170