ESP  0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
GRT::ThresholdDetection Class Reference

#include <ThresholdDetection.h>

Inheritance diagram for GRT::ThresholdDetection:

Public Member Functions

 ThresholdDetection (UINT bufferLength=100, UINT numDimensions=1, double alpha=4.0, double beta=1.2)
 
 ThresholdDetection (const ThresholdDetection &rhs)
 
virtual ~ThresholdDetection ()
 
ThresholdDetectionoperator= (const ThresholdDetection &rhs)
 
virtual bool deepCopyFrom (const FeatureExtraction *featureExtraction)
 
virtual bool computeFeatures (const VectorDouble &inputVector)
 
virtual bool reset ()
 
virtual bool saveModelToFile (string filename) const
 
virtual bool loadModelFromFile (string filename)
 
virtual bool saveModelToFile (fstream &file) const
 
virtual bool loadModelFromFile (fstream &file)
 
bool init (UINT bufferLength, UINT numDimensions, double alpha, double beta)
 
VectorDouble update (double x)
 
VectorDouble update (const VectorDouble &x)
 
CircularBuffer< VectorDouble > getBufferData ()
 
const CircularBuffer< VectorDouble > & getBufferData () const
 

Protected Attributes

UINT bufferLength
 
CircularBuffer< VectorDouble > dataBuffer
 
double alpha
 
double beta
 
bool inNoise
 

Static Protected Attributes

static RegisterFeatureExtractionModule< ThresholdDetectionregisterModule
 

Constructor & Destructor Documentation

GRT::ThresholdDetection::ThresholdDetection ( UINT  bufferLength = 100,
UINT  numDimensions = 1,
double  alpha = 4.0,
double  beta = 1.2 
)
GRT::ThresholdDetection::ThresholdDetection ( const ThresholdDetection rhs)

Copy constructor, copies the ThresholdDetection from the rhs instance to this instance.

Parameters
constThresholdDetection &rhs: another instance of the ThresholdDetection class from which the data will be copied to this instance
GRT::ThresholdDetection::~ThresholdDetection ( )
virtual

Default Destructor

Member Function Documentation

bool GRT::ThresholdDetection::computeFeatures ( const VectorDouble &  inputVector)
virtual

Sets the FeatureExtraction computeFeatures function, overwriting the base FeatureExtraction function. This function is called by the GestureRecognitionPipeline when any new input data needs to be processed (during the prediction phase for example). This function calls the ThresholdDetection's update function.

Parameters
constVectorDouble &inputVector: the inputVector that should be processed. Must have the same dimensionality as the FeatureExtraction module
Returns
returns true if the data was processed, false otherwise
bool GRT::ThresholdDetection::deepCopyFrom ( const FeatureExtraction *  featureExtraction)
virtual

Sets the FeatureExtraction deepCopyFrom function, overwriting the base FeatureExtraction function. This function is used to deep copy the values from the input pointer to this instance of the FeatureExtraction module. This function is called by the GestureRecognitionPipeline when the user adds a new FeatureExtraction module to the pipeline.

Parameters
FeatureExtraction*featureExtraction: a pointer to another instance of a ThresholdDetection, the values of that instance will be cloned to this instance
Returns
returns true if the deep copy was successful, false otherwise
CircularBuffer< VectorDouble > GRT::ThresholdDetection::getBufferData ( )

Get the circular buffer.

Returns
a copy of the circular buffer
const CircularBuffer< VectorDouble > & GRT::ThresholdDetection::getBufferData ( ) const

Gets a reference to the circular buffer.

Returns
a reference to the circular buffer
bool GRT::ThresholdDetection::init ( UINT  bufferLength,
UINT  numDimensions,
double  alpha,
double  beta 
)

Initializes the MovementTrajectoryFeatures

bool GRT::ThresholdDetection::loadModelFromFile ( string  filename)
virtual

This saves the feature extraction settings to a file.

Parameters
fstream&file: a reference to the file to save the settings to
Returns
returns true if the settings were saved successfully, false otherwise
bool GRT::ThresholdDetection::loadModelFromFile ( fstream &  file)
virtual

This loads the feature extraction settings from a file. This overrides the loadSettingsFromFile function in the FeatureExtraction base class.

Parameters
fstream&file: a reference to the file to load the settings from
Returns
returns true if the settings were loaded successfully, false otherwise
ThresholdDetection & GRT::ThresholdDetection::operator= ( const ThresholdDetection rhs)

Sets the equals operator, copies the data from the rhs instance to this instance.

Parameters
constThresholdDetection &rhs: another instance of the ThresholdDetection class from which the data will be copied to this instance
Returns
a reference to this instance of ThresholdDetection
bool GRT::ThresholdDetection::reset ( )
virtual

Sets the FeatureExtraction reset function, overwriting the base FeatureExtraction function. This function is called by the GestureRecognitionPipeline when the pipelines main reset() function is called. This function resets the feature extraction by re-initiliazing the instance.

Returns
true if the filter was reset, false otherwise
bool GRT::ThresholdDetection::saveModelToFile ( string  filename) const
virtual

This saves the feature extraction settings to a file.

Parameters
conststring filename: the filename to save the settings to
Returns
returns true if the settings were saved successfully, false otherwise
bool GRT::ThresholdDetection::saveModelToFile ( fstream &  file) const
virtual

This saves the feature extraction settings to a file. This overrides the saveSettingsToFile function in the FeatureExtraction base class.

Parameters
fstream&file: a reference to the file to save the settings to
Returns
returns true if the settings were saved successfully, false otherwise
VectorDouble GRT::ThresholdDetection::update ( double  x)

Computes the features from the input, this should only be called if the dimensionality of this instance was set to 1.

Parameters
doublex: the value to compute features from, this should only be called if the dimensionality of the filter was set to 1
Returns
a vector containing the features, an empty vector will be returned if the features were not computed
VectorDouble GRT::ThresholdDetection::update ( const VectorDouble &  x)

Computes the features from the input, the dimensionality of x should match that of this instance.

Parameters
constvector<double> &x: a vector containing the values to be processed, must be the same size as the numInputDimensions
Returns
a vector containing the features, an empty vector will be returned if the features were not computed

Member Data Documentation

double GRT::ThresholdDetection::alpha
protected
double GRT::ThresholdDetection::beta
protected
UINT GRT::ThresholdDetection::bufferLength
protected
CircularBuffer< VectorDouble > GRT::ThresholdDetection::dataBuffer
protected
bool GRT::ThresholdDetection::inNoise
protected
RegisterFeatureExtractionModule< ThresholdDetection > GRT::ThresholdDetection::registerModule
staticprotected

The documentation for this class was generated from the following files: