AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
agxUtil::ExponentialMovingAverageStatistic Class Reference

Exponential moving average statistic. More...

#include <Statistic.h>

+ Inheritance diagram for agxUtil::ExponentialMovingAverageStatistic:

Public Member Functions

 ExponentialMovingAverageStatistic (agx::Real smoothFactor, agx::Real initialObservation=0)
 
virtual ~ExponentialMovingAverageStatistic ()
 
virtual agx::Real get () const
 
agx::Real getSmoothFactor () const
 
void set (agx::Real val)
 Set the raw value of the statistic scalar.
 
void setSmoothFactor (agx::Real smoothFactor)
 
virtual agx::Real update (agx::Real observation)
 Updates the statistic given the current observation and returns the current value of this statistic.
 
- Public Member Functions inherited from agxUtil::Statistic
virtual ~Statistic ()
 
virtual agx::Real get () const =0
 
virtual agx::Real update (agx::Real observation)=0
 Updates the statistic given the current observation and returns the current value of this statistic.
 

Static Public Member Functions

static StatisticHandleRef make_statistic (agx::Real maxSmoothingFactor, agx::Real initialObservation=0)
 

Protected Attributes

agx::Real m_s
 
agx::Real m_smoothFactor
 

Detailed Description

Exponential moving average statistic.

At observation \(Y_n\) the statistic \(S_n\) is calculated as: \(S_n = S_{n-1} + \alpha \left( Y_n - S_{n-1} \right)\), where \( 0 < \alpha < 1\) is the smoothing factor.

Definition at line 93 of file Statistic.h.

Constructor & Destructor Documentation

◆ ExponentialMovingAverageStatistic()

agxUtil::ExponentialMovingAverageStatistic::ExponentialMovingAverageStatistic ( agx::Real  smoothFactor,
agx::Real  initialObservation = 0 
)
inline
Parameters
smoothFactor- the smoothing factor used to propagate the average (must be between zero and one)
initialObservation- initial observation, default zero (optional)

Definition at line 100 of file Statistic.h.

◆ ~ExponentialMovingAverageStatistic()

virtual agxUtil::ExponentialMovingAverageStatistic::~ExponentialMovingAverageStatistic ( )
inlinevirtual

Definition at line 128 of file Statistic.h.

Member Function Documentation

◆ get()

virtual agx::Real agxUtil::ExponentialMovingAverageStatistic::get ( ) const
inlinevirtual
Returns
the current value of this statistic

Implements agxUtil::Statistic.

Definition at line 116 of file Statistic.h.

◆ getSmoothFactor()

agx::Real agxUtil::ExponentialMovingAverageStatistic::getSmoothFactor ( ) const
inline
Returns
the smoothing factor

Definition at line 121 of file Statistic.h.

◆ make_statistic()

static StatisticHandleRef agxUtil::ExponentialMovingAverageStatistic::make_statistic ( agx::Real  maxSmoothingFactor,
agx::Real  initialObservation = 0 
)
inlinestatic

Definition at line 130 of file Statistic.h.

◆ set()

void agxUtil::ExponentialMovingAverageStatistic::set ( agx::Real  val)
inline

Set the raw value of the statistic scalar.

This will be stored without any smoothing. Can be used to initialize the object to a specific value.

Definition at line 114 of file Statistic.h.

◆ setSmoothFactor()

void agxUtil::ExponentialMovingAverageStatistic::setSmoothFactor ( agx::Real  smoothFactor)
inline
Parameters
smoothFactor- the smoothing factor

Definition at line 126 of file Statistic.h.

◆ update()

virtual agx::Real agxUtil::ExponentialMovingAverageStatistic::update ( agx::Real  observation)
inlinevirtual

Updates the statistic given the current observation and returns the current value of this statistic.

Parameters
observation- the current observation
Returns
the current value of this statistic

Implements agxUtil::Statistic.

Reimplemented in agxUtil::VariableSmoothFactorEMAStatistic.

Definition at line 103 of file Statistic.h.

Member Data Documentation

◆ m_s

agx::Real agxUtil::ExponentialMovingAverageStatistic::m_s
protected

Definition at line 139 of file Statistic.h.

◆ m_smoothFactor

agx::Real agxUtil::ExponentialMovingAverageStatistic::m_smoothFactor
protected

Definition at line 138 of file Statistic.h.


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