AIM
|
#include <SensorEvent.h>
Public Member Functions | |
SensorEvent (std::string name="sensor_event") | |
AIMValue | setProperty (const std::string &key, AIMValue value) |
void | doTick () |
Public Member Functions inherited from AIM | |
AIM (std::string name="") | |
AIM (const AIM &other) | |
AIM & | operator= (const AIM &rhs) |
virtual void | addDataSubscriber (const std::string &key, AIM *subscriber) |
virtual void | removeDataSubscriber (const std::string &key) |
virtual AIMValue | getProperty (std::string key) const |
virtual void | sendData () |
virtual void | addData (const AIMData &data) |
virtual std::string | exportProperties () |
virtual std::vector< std::pair < std::string, AIMValue > > | getOutputData (bool clear_output=false) |
virtual std::vector< std::pair < std::string, AIMValue > > | getInputData (bool clear_input=false) |
virtual AIM * | getDataSubscriber (std::string subscriber) |
virtual const std::map < std::string, AIMValue > & | getProperties () |
virtual std::string | getName () const |
virtual std::vector< AIMValue > | getRequirements () const |
virtual bool | requirementsAreUpdated (bool reset=true) const |
virtual void | setProperties (const std::map< std::string, AIMValue > &properties) |
Static Public Attributes | |
static const std::string | PROP_VARIANCE = "variance" |
static const std::string | PROP_TIME_WINDOW = "time window" |
static const std::string | PROP_LOWEST_VARIANCE = "lowest variance" |
static const std::string | PROP_VARIANCE_THRESHOLD = "variance threshold" |
static const std::string | PROP_IGNORE_START_UP_TIME = "ignore start up time" |
static const std::string | PROP_HIGHEST_VARIANCE = "highest variance" |
static const std::string | PROP_DATA_BUFFER = "data buffer" |
static const std::string | PROP_STD_SCORE_MEAN = "standard score mean" |
static const std::string | PROP_STD_SCORE_VARIANCE = "standard score variance" |
static const std::string | PROP_STD_SCORE_COUNT = "standard score count" |
static const std::string | PROP_FEATURE_NORMALIZATION = "normalization feature" |
static const std::string | FEATURE_NORMALIZATION_STD = "standard score normalization" |
static const std::string | FEATURE_NORMALIZATION_MINMAX = "min max normalization" |
static const std::string | PROP_LEARN_VARIANCE_BUFFER = "learn variance buffer" |
static const std::string | PROP_LEARN_RATE = "learn rate" |
static const std::string | PROP_LEARN_RATE_USE_NORM = "learn rate use normalization" |
static const std::string | PROP_LEARN_RATE_NORM_CNT = "learn rate normalization count" |
static const std::string | PROP_LEARN_PERCENTILE = "learn percentile" |
static const std::string | PROP_LEARN_VARIANCE = "learn variance" |
static const std::string | PROP_FUNC_LEARN_VARIANCE = "func learn variance" |
static const std::string | PROP_USE_ON_OFF_THRESHOLD = "use on off threshold" |
static const std::string | PROP_VARIANCE_THRESHOLD_OFF = "variance threshold off" |
Static Public Attributes inherited from AIM | |
static const std::string | VERSION = AIM_VERSION |
Additional Inherited Members | |
Public Types inherited from AIM | |
typedef std::pair< std::string, AIMValue > | AIMData |
typedef std::queue< AIMData > | AIMDataQueue |
typedef std::queue< AIMValue > | AIMValueQueue |
typedef std::map< std::string, AIMValueQueue > | InputDataQueue |
Protected Member Functions inherited from AIM | |
void | setDataSubscribers (const std::map< std::string, AIM * > &subscribers) |
void | setInputDataQueue (const InputDataQueue &inputDataQueue) |
void | setOutputDataQueue (const AIMDataQueue &outputDataQueue) |
Protected Attributes inherited from AIM | |
std::string | name |
std::vector< AIMValue > | requirements |
bool | requirementsUpdated |
std::map< std::string, AIM * > | dataSubscribers |
std::map< std::string, AIMValue > | properties |
InputDataQueue | inputDataQueue |
AIMDataQueue | outputDataQueue |
Created on: March 21, 2013 Author: Ted Schmidt
This SensorEvent module is a filter that looks for significant changes in sensor data and returns the data if there is such a change.
It measures the variance in the input data and based on the learned or set variance it determines if there is an event.
A time window can be specified to compute the variance in the sensor data on.
The lowest variance ever found will be used as reference threshold.
Removing the lowest variance value from the properties, will automatically re-calibrate the SensorEvent module.
This module accepts multi-dimensional input, in the form of a vector with AIMValues.
The dimensions should not change for a sensor stream.
Manually set the variance:
{"variance":vector<double>(0.1)} the variance can be either an integer, float, or double
Use the learned variance by removing the learned variance
{"variance":null} set an empty AIMValue object
Set the time window:
{"time window":1.3} the max time window in seconds to learn and compute the variance over, can be either integer or double.
Set the threshold:
{"variance threshold" : 0.01} The threshold to send an event. This is the percentage of the normalized variance values.
Returns:
It returns the input data if the normalized variance is higher then the threshold value.
The input vector is returned in the data field and the normalized variance in the variance field
SensorEvent::SensorEvent | ( | std::string | name = "sensor_event" | ) |
The SensorEvent constructor
By default the variance threshold is set to 0.05 (5%) of the observed maximum variance in the time window, minus the observed noise observed. By default the start up time is ignored and the module will look for events even when the buffer is not full.
|
virtual |
Do an AIM tick
This method is called to tick the AI-module to do its processing. During this tick the AI module grabs it's input data, does its processing, and sends the data to its data receivers. This method can be used in combination with AIM priorities, to streamline the data flow and timers for timed AI modules.
Reimplemented from AIM.
Set the properties
Reimplemented from AIM.
|
static |
Feature type for the normalization feature: min max
|
static |
Feature type for the normalization feature: standard score / z-score
|
static |
Property key for the data buffer
|
static |
Property key for the normalization feature
property for the normalization feature
|
static |
Property key to run the learning function, needs as input a map with start_time and end_time epoch values
|
static |
Property key for the highest observed variance vector
|
static |
Property key to ignore waiting for full buffers, if set to true, it will look for events even on not full buffers
|
static |
Property key for the percentile to use for learning
|
static |
Property key for the variance learn rate
|
static |
Property key for the normalization count
|
static |
Property key for using normalizaion for the learn rate
|
static |
Property key to enabled disable the learning of the variance
|
static |
Property key for the variance buffer for learning
|
static |
Property key for the lowest observed variance vector
|
static |
Property key for the standard score count
|
static |
Property key for the standard score mean
properties for standard score normalization
|
static |
Property key for the standard score variance
|
static |
Property key for the buffer time window to compute the variance over
|
static |
Property key to enabled disable the use of the on off threshold
|
static |
Property key for a predefined lowest variance vector
properties for min max normalization
|
static |
Property key for the variance threshold value, between 0-1, where 0 is lowest variance observed and 1 the highest
|
static |
Property key for the off threshold variance