Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
vpStatisticalTestHinkley Class Reference

#include <visp3/core/vpStatisticalTestHinkley.h>

+ Inheritance diagram for vpStatisticalTestHinkley:

Public Types

enum  vpMeanDriftType {
  MEAN_DRIFT_NONE = 0 , MEAN_DRIFT_DOWNWARD = 1 , MEAN_DRIFT_UPWARD = 2 , MEAN_DRIFT_BOTH = 3 ,
  MEAN_DRIFT_COUNT = 4 , MEAN_DRIFT_UNKNOWN = MEAN_DRIFT_COUNT
}
 
typedef enum vpStatisticalTestAbstract::vpMeanDriftType vpMeanDriftType
 

Public Member Functions

 vpStatisticalTestHinkley ()
 
 vpStatisticalTestHinkley (const float &alpha, const float &delta, const unsigned int &nbSamplesForInit=30)
 
 vpStatisticalTestHinkley (const float &h, const float &k, const bool &computeAlphaDeltaFromStdev, const unsigned int &nbSamplesForInit=30)
 
 vpStatisticalTestHinkley (const float &h, const float &k, const float &mean, const float &stdev)
 
virtual ~vpStatisticalTestHinkley ()
 
float getAlpha () const
 
float getSk () const
 
float getMk () const
 
float getTk () const
 
float getNk () const
 
void init ()
 
void init (const float &alpha, const float &delta, const unsigned int &nbSamplesForInit)
 
void init (const float &h, const float &k, const bool &computeAlphaDeltaFromStdev, const unsigned int &nbSamplesForInit)
 
void init (const float &alpha, const float &delta, const float &mean)
 
void init (const float &h, const float &k, const float &mean, const float &stdev)
 
void setDelta (const float &delta)
 
void setAlpha (const float &alpha)
 
void getLimits (float &limitDown, float &limitUp) const
 
float getMean () const
 
float getStdev () const
 
void setMinStdev (const float &stdevmin)
 
void setNbSamplesForStat (const unsigned int &nbSamples)
 
vpMeanDriftType testDownUpwardMeanDrift (const float &signal)
 
vpMeanDriftType testDownwardMeanDrift (const float &signal)
 
vpMeanDriftType testUpwardMeanDrift (const float &signal)
 

Static Public Member Functions

static std::string vpMeanDriftTypeToString (const vpMeanDriftType &type)
 
static vpMeanDriftType vpMeanDriftTypeFromString (const std::string &name)
 
static std::string getAvailableMeanDriftType (const std::string &prefix="<", const std::string &sep=" , ", const std::string &suffix=">")
 
static void print (const vpMeanDriftType &type)
 

Protected Member Functions

virtual void computeAlphaDelta ()
 
void computeMean (double signal)
 
void computeSk (double signal)
 
void computeMk ()
 
void computeTk (double signal)
 
void computeNk ()
 
virtual vpMeanDriftType detectDownwardMeanDrift () override
 
virtual vpMeanDriftType detectUpwardMeanDrift () override
 
virtual bool updateStatistics (const float &signal) override
 
virtual void updateTestSignals (const float &signal) override
 

Protected Attributes

float m_dmin2
 
float m_alpha
 
float m_Sk
 
float m_Mk
 
float m_Tk
 
float m_Nk
 
bool m_computeDeltaAndAlpha
 
float m_h
 
float m_k
 
bool m_areStatisticsComputed
 
float m_count
 
float m_limitDown
 
float m_limitUp
 
float m_mean
 
unsigned int m_nbSamplesForStatistics
 
float * m_s
 
float m_stdev
 
float m_stdevmin
 
float m_sumForMean
 

Detailed Description

This class implements the Hinkley's cumulative sum test.

The Hinkley's cumulative sum test is designed to detect drift in the mean of an observed signal $ s(t) $. It is known to be robust (by taking into account all the past of the observed quantity), efficient, and inducing a very low computational load. The other attractive features of this test are two-fold. First, it can straightforwardly and accurately provide the drift instant. Secondly, due to its formulation (cumulative sum test), it can simultaneously handle both very abrupt and important changes, and gradual smaller ones without adapting the involved thresholds.

Two tests are performed in parallel to look for downwards or upwards drifts in $ s(t) $, respectively defined by:

\[ S_k = \sum_{t=0}^{k} (s(t) - m_0 + \frac{\delta}{2}) \]

\[ M_k = \max_{0 \leq i \leq k} S_i\]

\[ T_k = \sum_{t=0}^{k} (s(t) - m_0 - \frac{\delta}{2}) \]

\[ N_k = \min_{0 \leq i \leq k} T_i\]

In which $m_o$ is computed on-line and corresponds to the mean of the signal $ s(t) $ we want to detect a drift. $m_o$ is re-initialized at zero after each drift detection. $\delta$ denotes the drift minimal magnitude that we want to detect and $\alpha$ is a predefined threshold. These values are set by default to 0.2 in the default constructor vpHinkley(). To modify the default values use setAlpha() and setDelta() or the vpHinkley(double alpha, double delta) constructor.

A downward drift is detected if $ M_k - S_k > \alpha $. A upward drift is detected if $ T_k - N_k > \alpha $.

To detect only downward drifts in $ s(t) $ use testDownwardMeanDrift().To detect only upward drifts in $ s(t) $ use testUpwardMeanDrift(). To detect both, downward and upward drifts use testDownUpwardMeanDrift().

If a drift is detected, the drift location is given by the last instant $k^{'}$ when $ M_{k^{'}} - S_{k^{'}} = 0 $, or $ T_{k^{'}} - N_{k^{'}} = 0 $.

Examples
testSPC.cpp, and tutorial-meandrift.cpp.

Definition at line 88 of file vpStatisticalTestHinkley.h.

Member Typedef Documentation

◆ vpMeanDriftType

Enum that indicates if a drift of the mean occurred.

Member Enumeration Documentation

◆ vpMeanDriftType

Enum that indicates if a drift of the mean occurred.

Enumerator
MEAN_DRIFT_NONE 

No mean drift occurred

MEAN_DRIFT_DOWNWARD 

A downward drift of the mean occurred.

MEAN_DRIFT_UPWARD 

An upward drift of the mean occurred.

MEAN_DRIFT_BOTH 

Both an aupward and a downward drifts occurred.

MEAN_DRIFT_COUNT 
MEAN_DRIFT_UNKNOWN 

Definition at line 63 of file vpStatisticalTestAbstract.h.

Constructor & Destructor Documentation

◆ vpStatisticalTestHinkley() [1/4]

BEGIN_VISP_NAMESPACE vpStatisticalTestHinkley::vpStatisticalTestHinkley ( )

Construct a new vpStatisticalTestHinkley object. Call init() to initialise the Hinkley's test and set $\alpha$ and $\delta$ to default values.

By default $ \delta = 0.2 $ and $ \alpha = 0.2$. Use setDelta() and setAlpha() to modify these values.

Definition at line 49 of file vpStatisticalTestHinkley.cpp.

References init().

◆ vpStatisticalTestHinkley() [2/4]

vpStatisticalTestHinkley::vpStatisticalTestHinkley ( const float &  alpha,
const float &  delta,
const unsigned int &  nbSamplesForInit = 30 
)

Call init() to initialise the Hinkley's test and set $\alpha$ and $\delta$ thresholds.

Parameters
[in]alpha: $\alpha$ threshold indicating that a mean drift occurs.
[in]delta: $\delta$ denotes the drift minimal magnitude that we want to detect.
[in]nbSamplesForInit: number of signal samples to initialize the mean of the signal.
See also
setAlpha(), setDelta()

Definition at line 64 of file vpStatisticalTestHinkley.cpp.

References init().

◆ vpStatisticalTestHinkley() [3/4]

vpStatisticalTestHinkley::vpStatisticalTestHinkley ( const float &  h,
const float &  k,
const bool &  computeAlphaDeltaFromStdev,
const unsigned int &  nbSamplesForInit = 30 
)

Construct a new vpStatisticalTestHinkley object. $\alpha$ and $\delta$ will be computed from the standard deviation of the signal.

Parameters
[in]h: the alarm factor that permits to compute $\alpha$ from the standard deviation.
[in]k: the detection factor that permits to compute $\delta$ from the standard deviation.
[in]computeAlphaDeltaFromStdev: must be equal to true, otherwise throw a vpException.
[in]nbSamplesForInit: number of signal samples to initialize the mean of the signal.

Definition at line 79 of file vpStatisticalTestHinkley.cpp.

References init().

◆ vpStatisticalTestHinkley() [4/4]

vpStatisticalTestHinkley::vpStatisticalTestHinkley ( const float &  h,
const float &  k,
const float &  mean,
const float &  stdev 
)

Construct a new vpStatisticalTestHinkley object. $\alpha$ and $\delta$ will be computed from the standard deviation of the signal.

Parameters
[in]h: the alarm factor that permits to compute $\alpha$ from the standard deviation.
[in]k: the detection factor that permits to compute $\delta$ from the standard deviation.
[in]mean: the expected mean of the signal.
[in]stdev: the expected standard deviation of the signal.

Definition at line 85 of file vpStatisticalTestHinkley.cpp.

References init().

◆ ~vpStatisticalTestHinkley()

vpStatisticalTestHinkley::~vpStatisticalTestHinkley ( )
virtual

Destroy the vpStatisticalTestHinkley object.

Definition at line 149 of file vpStatisticalTestHinkley.cpp.

Member Function Documentation

◆ computeAlphaDelta()

void vpStatisticalTestHinkley::computeAlphaDelta ( )
protectedvirtual

Compute $\delta$ and $\alpha$ from the standard deviation of the signal.

Definition at line 160 of file vpStatisticalTestHinkley.cpp.

References m_h, m_k, vpStatisticalTestAbstract::m_stdev, setAlpha(), and setDelta().

Referenced by init(), and updateStatistics().

◆ computeMean()

void vpStatisticalTestHinkley::computeMean ( double  signal)
protected

Compute the mean value $m_0$ of the signal. The mean value must be computed before the mean drift is estimated on-line.

Parameters
[in]signalThe new value of the signal to monitor.

Definition at line 168 of file vpStatisticalTestHinkley.cpp.

References vpStatisticalTestAbstract::m_count, vpStatisticalTestAbstract::m_mean, m_Mk, m_Nk, m_Sk, m_Tk, and vpMath::maximum().

Referenced by updateTestSignals().

◆ computeMk()

void vpStatisticalTestHinkley::computeMk ( )
protected

Compute $M_k$, the maximum value of $S_k$.

Definition at line 186 of file vpStatisticalTestHinkley.cpp.

References m_Mk, and m_Sk.

Referenced by updateTestSignals().

◆ computeNk()

void vpStatisticalTestHinkley::computeNk ( )
protected

Compute $N_k$, the minimum value of $T_k$.

Definition at line 198 of file vpStatisticalTestHinkley.cpp.

References m_Nk, and m_Tk.

Referenced by updateTestSignals().

◆ computeSk()

void vpStatisticalTestHinkley::computeSk ( double  signal)
protected

Compute $S_k = \sum_{t=0}^{k} (s(t) - m_0 + \frac{\delta}{2})$.

Parameters
[in]signalThe new value of the signal to monitor.

Definition at line 181 of file vpStatisticalTestHinkley.cpp.

References m_dmin2, vpStatisticalTestAbstract::m_mean, and m_Sk.

Referenced by updateTestSignals().

◆ computeTk()

void vpStatisticalTestHinkley::computeTk ( double  signal)
protected

Compute $T_k = \sum_{t=0}^{k} (s(t) - m_0 - \frac{\delta}{2})$.

Parameters
[in]signalThe new value of the signal to monitor.

Definition at line 193 of file vpStatisticalTestHinkley.cpp.

References m_dmin2, vpStatisticalTestAbstract::m_mean, and m_Tk.

Referenced by updateTestSignals().

◆ detectDownwardMeanDrift()

vpStatisticalTestAbstract::vpMeanDriftType vpStatisticalTestHinkley::detectDownwardMeanDrift ( )
overrideprotectedvirtual

Detects if a downward mean drift occurred.

Returns
vpMeanDriftType::MEAN_DRIFT_DOWNWARD if a downward mean drift occurred, vpMeanDriftType::MEAN_DRIFT_NONE otherwise.

Implements vpStatisticalTestAbstract.

Definition at line 205 of file vpStatisticalTestHinkley.cpp.

References m_alpha, m_Mk, m_Sk, vpStatisticalTestAbstract::MEAN_DRIFT_DOWNWARD, and vpStatisticalTestAbstract::MEAN_DRIFT_NONE.

◆ detectUpwardMeanDrift()

vpStatisticalTestAbstract::vpMeanDriftType vpStatisticalTestHinkley::detectUpwardMeanDrift ( )
overrideprotectedvirtual

Detects if an upward mean drift occurred on the mean.

Returns
vpMeanDriftType::MEAN_DRIFT_UPWARD if an upward mean drift occurred, vpMeanDriftType::MEAN_DRIFT_NONE otherwise.
See also
detectDownwardMeanDrift()

Implements vpStatisticalTestAbstract.

Definition at line 214 of file vpStatisticalTestHinkley.cpp.

References m_alpha, m_Nk, m_Tk, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, and vpStatisticalTestAbstract::MEAN_DRIFT_UPWARD.

◆ getAlpha()

float vpStatisticalTestHinkley::getAlpha ( ) const
inline

Get the $\alpha$ threshold indicating that a mean drift occurs.

Returns
The $\alpha$ threshold.

Definition at line 240 of file vpStatisticalTestHinkley.h.

◆ getAvailableMeanDriftType()

std::string vpStatisticalTestAbstract::getAvailableMeanDriftType ( const std::string &  prefix = "<",
const std::string &  sep = " , ",
const std::string &  suffix = ">" 
)
staticinherited

Get the list of available vpMeanDriftType objects that are handled.

Parameters
[in]prefixThe prefix that should be placed before the list.
[in]sepThe separator between each element of the list.
[in]suffixThe suffix that should terminate the list.
Returns
std::string The list of handled type of process tests, presented as a string.
Examples
tutorial-meandrift.cpp.

Definition at line 82 of file vpStatisticalTestAbstract.cpp.

References vpStatisticalTestAbstract::MEAN_DRIFT_COUNT, and vpStatisticalTestAbstract::vpMeanDriftTypeToString().

◆ getLimits()

void vpStatisticalTestAbstract::getLimits ( float &  limitDown,
float &  limitUp 
) const
inlineinherited

Get the upper and lower limits of the test signal.

Parameters
[out]limitDownThe lower limit.
[out]limitUpThe upper limit.
Examples
testSPC.cpp, and tutorial-meandrift.cpp.

Definition at line 175 of file vpStatisticalTestAbstract.h.

◆ getMean()

float vpStatisticalTestAbstract::getMean ( ) const
inlineinherited

Get the mean used as reference.

Returns
float The mean.
Examples
tutorial-meandrift.cpp.

Definition at line 186 of file vpStatisticalTestAbstract.h.

◆ getMk()

float vpStatisticalTestHinkley::getMk ( ) const
inline

Get the maximum of the test signal for downward mean drift $S_k$ .

Returns
The value of $M_k$, the maximum value of $S_k$.
Examples
tutorial-meandrift.cpp.

Definition at line 254 of file vpStatisticalTestHinkley.h.

◆ getNk()

float vpStatisticalTestHinkley::getNk ( ) const
inline

Get the minimum of the test signal for upward mean drift $T_k$.

Returns
The value of $N_k$, the minimum value of $T_k$.
Examples
tutorial-meandrift.cpp.

Definition at line 269 of file vpStatisticalTestHinkley.h.

◆ getSk()

float vpStatisticalTestHinkley::getSk ( ) const
inline

Get the test signal for downward mean drift.

Returns
The value of $S_k = \sum_{t=0}^{k} (s(t) - m_0 + \frac{\delta}{2})$ .
Examples
tutorial-meandrift.cpp.

Definition at line 247 of file vpStatisticalTestHinkley.h.

◆ getStdev()

float vpStatisticalTestAbstract::getStdev ( ) const
inlineinherited

Get the standard deviation used as reference.

Returns
float The standard deviation.
Examples
tutorial-meandrift.cpp.

Definition at line 196 of file vpStatisticalTestAbstract.h.

◆ getTk()

float vpStatisticalTestHinkley::getTk ( ) const
inline

Get the test signal for upward mean drift..

Returns
The value of $T_k = \sum_{t=0}^{k} (s(t) - m_0 - \frac{\delta}{2})$ .
Examples
tutorial-meandrift.cpp.

Definition at line 262 of file vpStatisticalTestHinkley.h.

◆ init() [1/5]

void vpStatisticalTestHinkley::init ( )

Initialise the Hinkley's test by setting the mean signal value $m_0$ to zero as well as $S_k, M_k, T_k, N_k$.

Definition at line 91 of file vpStatisticalTestHinkley.cpp.

References vpStatisticalTestAbstract::init(), m_alpha, m_computeDeltaAndAlpha, m_Mk, m_Nk, m_Sk, m_Tk, setAlpha(), and vpStatisticalTestAbstract::setNbSamplesForStat().

Referenced by init(), and vpStatisticalTestHinkley().

◆ init() [2/5]

void vpStatisticalTestHinkley::init ( const float &  alpha,
const float &  delta,
const float &  mean 
)

Call init() to initialise the Hinkley's test, set $\alpha$ and $\delta$ thresholds, and the mean of the signal $m_0$.

Parameters
[in]alphaThe threshold indicating that a mean drift occurs.
[in]deltaThe drift minimal magnitude that we want to detect.
[in]meanThe expected value of the mean.

Definition at line 115 of file vpStatisticalTestHinkley.cpp.

References init(), vpStatisticalTestAbstract::m_areStatisticsComputed, m_computeDeltaAndAlpha, vpStatisticalTestAbstract::m_mean, setAlpha(), and setDelta().

◆ init() [3/5]

void vpStatisticalTestHinkley::init ( const float &  alpha,
const float &  delta,
const unsigned int &  nbSamplesForInit 
)

Call init() to initialise the Hinkley's test and set $\alpha$ and $\delta$ thresholds.

Parameters
[in]alphaThe threshold indicating that a mean drift occurs.
[in]deltaThe drift minimal magnitude that we want to detect.
[in]nbSamplesForInit: number of signal samples to initialize the mean of the signal.

Definition at line 106 of file vpStatisticalTestHinkley.cpp.

References init(), m_computeDeltaAndAlpha, setAlpha(), setDelta(), and vpStatisticalTestAbstract::setNbSamplesForStat().

◆ init() [4/5]

void vpStatisticalTestHinkley::init ( const float &  h,
const float &  k,
const bool &  computeAlphaDeltaFromStdev,
const unsigned int &  nbSamplesForInit 
)

(Re)Initialize a new vpStatisticalTestHinkley object. $\alpha$ and $\delta$ will be computed from the standard deviation of the signal.

Parameters
[in]h: the alarm factor that permits to compute $\alpha$ from the standard deviation.
[in]k: the detection factor that permits to compute $\delta$ from the standard deviation.
[in]computeAlphaDeltaFromStdev: must be equal to true, otherwise throw a vpException.
[in]nbSamplesForInit: number of signal samples to initialize the mean of the signal.

Definition at line 125 of file vpStatisticalTestHinkley.cpp.

References vpException::badValue, init(), m_computeDeltaAndAlpha, m_h, m_k, and vpStatisticalTestAbstract::setNbSamplesForStat().

◆ init() [5/5]

void vpStatisticalTestHinkley::init ( const float &  h,
const float &  k,
const float &  mean,
const float &  stdev 
)

(Re)Initialize a new vpStatisticalTestHinkley object. $\alpha$ and $\delta$ will be computed from the standard deviation of the signal.

Parameters
[in]h: the alarm factor that permits to compute $\alpha$ from the standard deviation.
[in]k: the detection factor that permits to compute $\delta$ from the standard deviation.
[in]mean: the expected mean of the signal.
[in]stdev: the expected standard deviation of the signal.

Definition at line 137 of file vpStatisticalTestHinkley.cpp.

References computeAlphaDelta(), init(), vpStatisticalTestAbstract::m_areStatisticsComputed, m_computeDeltaAndAlpha, m_h, m_k, vpStatisticalTestAbstract::m_mean, and vpStatisticalTestAbstract::m_stdev.

◆ print()

void vpStatisticalTestAbstract::print ( const vpMeanDriftType type)
staticinherited

Print the message corresponding to the type of mean drift.

Parameters
[in]typeThe type of mean drift.

Definition at line 95 of file vpStatisticalTestAbstract.cpp.

References vpStatisticalTestAbstract::vpMeanDriftTypeToString().

◆ setAlpha()

void vpStatisticalTestHinkley::setAlpha ( const float &  alpha)

The threshold indicating that a mean drift occurs.

Parameters
[in]alphaThe threshold.

Definition at line 153 of file vpStatisticalTestHinkley.cpp.

References m_alpha, vpStatisticalTestAbstract::m_limitDown, and vpStatisticalTestAbstract::m_limitUp.

Referenced by computeAlphaDelta(), and init().

◆ setDelta()

void vpStatisticalTestHinkley::setDelta ( const float &  delta)

Set the drift minimal magnitude that we want to detect.

Parameters
[in]deltaThe drift magnitude.

Definition at line 151 of file vpStatisticalTestHinkley.cpp.

References m_dmin2.

Referenced by computeAlphaDelta(), and init().

◆ setMinStdev()

void vpStatisticalTestAbstract::setMinStdev ( const float &  stdevmin)
inlineinherited

Set the minimum value of the standard deviation that is expected. The computed standard deviation cannot be lower this value if set.

Parameters
[in]stdevminThe minimum value of the standard deviation that is expected.

Definition at line 220 of file vpStatisticalTestAbstract.h.

◆ setNbSamplesForStat()

void vpStatisticalTestAbstract::setNbSamplesForStat ( const unsigned int &  nbSamples)
inherited

Set the number of samples required to compute the mean and standard deviation of the signal and allocate the memory accordingly.

Parameters
[in]nbSamplesThe number of samples we want to use.

Definition at line 190 of file vpStatisticalTestAbstract.cpp.

References vpStatisticalTestAbstract::m_nbSamplesForStatistics, and vpStatisticalTestAbstract::m_s.

Referenced by init(), vpStatisticalTestEWMA::init(), vpStatisticalTestMeanAdjustedCUSUM::init(), vpStatisticalTestSigma::init(), and vpStatisticalTestAbstract::operator=().

◆ testDownUpwardMeanDrift()

vpStatisticalTestAbstract::vpMeanDriftType vpStatisticalTestAbstract::testDownUpwardMeanDrift ( const float &  signal)
inherited

Test if a downward or an upward mean drift occurred according to the new value of the signal.

Parameters
[in]signalThe new value of the signal.
Returns
vpMeanDriftType The type of mean drift that occurred.
See also
testDownwardMeanDrift() testUpwardMeanDrift()
Examples
testSPC.cpp, and tutorial-meandrift.cpp.

Definition at line 199 of file vpStatisticalTestAbstract.cpp.

References vpStatisticalTestAbstract::detectDownwardMeanDrift(), vpStatisticalTestAbstract::detectUpwardMeanDrift(), vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::MEAN_DRIFT_BOTH, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestAbstract::updateTestSignals().

◆ testDownwardMeanDrift()

vpStatisticalTestAbstract::vpMeanDriftType vpStatisticalTestAbstract::testDownwardMeanDrift ( const float &  signal)
inherited

Test if a downward mean drift occurred according to the new value of the signal.

Parameters
[in]signalThe new value of the signal.
Returns
vpMeanDriftType The type of mean drift that occurred.
See also
testUpwardMeanDrift()

Definition at line 224 of file vpStatisticalTestAbstract.cpp.

References vpStatisticalTestAbstract::detectDownwardMeanDrift(), vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestAbstract::updateTestSignals().

◆ testUpwardMeanDrift()

vpStatisticalTestAbstract::vpMeanDriftType vpStatisticalTestAbstract::testUpwardMeanDrift ( const float &  signal)
inherited

Test if an upward mean drift occurred according to the new value of the signal.

Parameters
[in]signalThe new value of the signal.
Returns
vpMeanDriftType The type of mean drift that occurred.
See also
testDownwardMeanDrift()

Definition at line 236 of file vpStatisticalTestAbstract.cpp.

References vpStatisticalTestAbstract::detectUpwardMeanDrift(), vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestAbstract::updateTestSignals().

◆ updateStatistics()

bool vpStatisticalTestHinkley::updateStatistics ( const float &  signal)
overrideprotectedvirtual

Update m_s and if enough values are available, compute the mean, the standard deviation and the limits.

Parameters
[in]signalThe new value of the signal to monitor.

Reimplemented from vpStatisticalTestAbstract.

Definition at line 223 of file vpStatisticalTestHinkley.cpp.

References computeAlphaDelta(), vpStatisticalTestAbstract::m_areStatisticsComputed, m_computeDeltaAndAlpha, m_Mk, m_Nk, m_Sk, m_Tk, and vpStatisticalTestAbstract::updateStatistics().

◆ updateTestSignals()

void vpStatisticalTestHinkley::updateTestSignals ( const float &  signal)
overrideprotectedvirtual

Update the test signals.

Parameters
[in]signalThe new value of the signal to monitor.

Implements vpStatisticalTestAbstract.

Definition at line 240 of file vpStatisticalTestHinkley.cpp.

References computeMean(), computeMk(), computeNk(), computeSk(), computeTk(), and vpStatisticalTestAbstract::m_count.

◆ vpMeanDriftTypeFromString()

vpStatisticalTestAbstract::vpMeanDriftType vpStatisticalTestAbstract::vpMeanDriftTypeFromString ( const std::string &  name)
staticinherited

Cast a string into a vpMeanDriftType.

Parameters
[in]nameThe name of the mean drift.
Returns
vpMeanDriftType The corresponding vpMeanDriftType.
Examples
tutorial-meandrift.cpp.

Definition at line 65 of file vpStatisticalTestAbstract.cpp.

References vpStatisticalTestAbstract::MEAN_DRIFT_COUNT, vpStatisticalTestAbstract::MEAN_DRIFT_UNKNOWN, and vpStatisticalTestAbstract::vpMeanDriftTypeToString().

◆ vpMeanDriftTypeToString()

BEGIN_VISP_NAMESPACE std::string vpStatisticalTestAbstract::vpMeanDriftTypeToString ( const vpMeanDriftType type)
staticinherited

Member Data Documentation

◆ m_alpha

float vpStatisticalTestHinkley::m_alpha
protected

The $\alpha$ threshold indicating that a mean drift occurs.

Definition at line 92 of file vpStatisticalTestHinkley.h.

Referenced by detectDownwardMeanDrift(), detectUpwardMeanDrift(), init(), and setAlpha().

◆ m_areStatisticsComputed

◆ m_computeDeltaAndAlpha

bool vpStatisticalTestHinkley::m_computeDeltaAndAlpha
protected

If true, compute $\delta$ and $\alpha$ from the standard deviation, the alarm factor and the detection factor.

Definition at line 97 of file vpStatisticalTestHinkley.h.

Referenced by init(), and updateStatistics().

◆ m_count

float vpStatisticalTestAbstract::m_count
protectedinherited

Current number of data used to compute the mean and the standard deviation.

Definition at line 109 of file vpStatisticalTestAbstract.h.

Referenced by computeMean(), vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestAbstract::updateStatistics(), and updateTestSignals().

◆ m_dmin2

float vpStatisticalTestHinkley::m_dmin2
protected

Half of $\delta$, the drift minimal magnitude that we want to detect.

Definition at line 91 of file vpStatisticalTestHinkley.h.

Referenced by computeSk(), computeTk(), and setDelta().

◆ m_h

float vpStatisticalTestHinkley::m_h
protected

The alarm factor, that permits to compute $\alpha$ from the standard deviation of the signal.

Definition at line 99 of file vpStatisticalTestHinkley.h.

Referenced by computeAlphaDelta(), and init().

◆ m_k

float vpStatisticalTestHinkley::m_k
protected

The detection factor, that permits to compute $\delta$ from the standard deviation of the signal.

Definition at line 100 of file vpStatisticalTestHinkley.h.

Referenced by computeAlphaDelta(), and init().

◆ m_limitDown

◆ m_limitUp

◆ m_mean

◆ m_Mk

float vpStatisticalTestHinkley::m_Mk
protected

Maximum of the test signal for downward mean drift $S_k$ .

Definition at line 94 of file vpStatisticalTestHinkley.h.

Referenced by computeMean(), computeMk(), detectDownwardMeanDrift(), init(), and updateStatistics().

◆ m_nbSamplesForStatistics

unsigned int vpStatisticalTestAbstract::m_nbSamplesForStatistics
protectedinherited

Number of samples to use to compute the mean and the standard deviation.

Definition at line 113 of file vpStatisticalTestAbstract.h.

Referenced by vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestAbstract::setNbSamplesForStat(), and vpStatisticalTestAbstract::updateStatistics().

◆ m_Nk

float vpStatisticalTestHinkley::m_Nk
protected

Minimum of the test signal for upward mean drift $T_k$

Definition at line 96 of file vpStatisticalTestHinkley.h.

Referenced by computeMean(), computeNk(), detectUpwardMeanDrift(), init(), and updateStatistics().

◆ m_s

float* vpStatisticalTestAbstract::m_s
protectedinherited

◆ m_Sk

float vpStatisticalTestHinkley::m_Sk
protected

Test signal for downward mean drift.

Definition at line 93 of file vpStatisticalTestHinkley.h.

Referenced by computeMean(), computeMk(), computeSk(), detectDownwardMeanDrift(), init(), and updateStatistics().

◆ m_stdev

◆ m_stdevmin

float vpStatisticalTestAbstract::m_stdevmin
protectedinherited

Minimum allowed standard deviation of the monitored signal.

Definition at line 116 of file vpStatisticalTestAbstract.h.

Referenced by vpStatisticalTestAbstract::updateStatistics().

◆ m_sumForMean

float vpStatisticalTestAbstract::m_sumForMean
protectedinherited

◆ m_Tk

float vpStatisticalTestHinkley::m_Tk
protected

Test signal for upward mean drift.

Definition at line 95 of file vpStatisticalTestHinkley.h.

Referenced by computeMean(), computeNk(), computeTk(), detectUpwardMeanDrift(), init(), and updateStatistics().