DGtal
0.6.devel
|
#include <Statistic.h>
Public Member Functions | |
~Statistic () | |
Statistic (bool storeSample=false) | |
Statistic (const Statistic &other) | |
Statistic & | operator= (const Statistic &other) |
Statistic & | operator+= (const Statistic &other) |
Statistic | operator+ (const Statistic &other) const |
unsigned int | samples () const |
RealNumberType | mean () const |
RealNumberType | variance () const |
RealNumberType | unbiasedVariance () const |
RealNumberType | max () const |
RealNumberType | min () const |
RealNumberType | median () |
void | addValue (RealNumberType v) |
template<class Iter > | |
void | addValues (Iter b, Iter e) |
void | clear () |
void | terminate () |
void | selfDisplay (std::ostream &that_stream) const |
bool | OK () const |
Private Attributes | |
unsigned int | mySamples |
RealNumberType | myExp |
RealNumberType | myExp2 |
RealNumberType | myMax |
RealNumberType | myMin |
RealNumberType | myMedian |
std::vector< RealNumberType > | myValues |
bool | myStoreSamples |
bool | myIsTerminated |
Aim: This class processes a set of sample values for one variable and can then compute different statistics, like sample mean, sample variance, sample unbiased variance, etc. It is minimalistic for space efficiency. For multiple variables, sample storage and others, see Statistics class.
Description of class 'Statistic'
Backported from ImaGene. Lachaud03b
Definition at line 66 of file Statistic.h.
|
inline |
|
inline |
Constructor.
Definition at line 52 of file Statistic.ih.
References DGtal::false, and DGtal::Statistic< RealNumberType >::myValues.
|
inline |
Copy constructor.
other | the object to clone. |
Definition at line 66 of file Statistic.ih.
References DGtal::Statistic< RealNumberType >::myValues.
|
inline |
Adds a new sample value [v].
v | the new sample value. |
Definition at line 286 of file Statistic.ih.
Referenced by DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare(), and DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors().
|
inline |
Adds a sequence of sample values, scanning a container from iterators [b] to [e].
Exemple:
b | an iterator on the starting point. |
e | an iterator after the last point. |
Adds a sequence of sample values, scanning a container from iterators [b] to [e].
Exemple: vector<RealNumberType> x; Statistic stats; stats.addValue( x + 4, x + 10 ); <endcode>
b | an iterator on the starting point. |
e | an iterator after the last point. |
Definition at line 321 of file Statistic.ih.
|
inline |
Clears the object. As if it has just been created.
Definition at line 333 of file Statistic.ih.
References DGtal::Statistic< RealNumberType >::clear().
Referenced by DGtal::Statistic< RealNumberType >::clear().
|
inline |
|
inline |
Definition at line 199 of file Statistic.ih.
|
inline |
Return the median value of the Statistic values. It can be given in two possible cases:
if the the values are stored in the 'Statistic' objects (not always a good solution). (complexity: linear on average)
Definition at line 263 of file Statistic.ih.
|
inline |
|
inline |
Checks the validity/consistency of the object.
Definition at line 403 of file Statistic.ih.
|
inline |
Adds two set of statistics (should be of the same variable).
other | the object to add. |
Definition at line 167 of file Statistic.ih.
|
inline |
Adds to self another set of statistics (should be of the same variable).
other | the object to add. |
Definition at line 129 of file Statistic.ih.
References DGtal::Statistic< RealNumberType >::myExp, DGtal::Statistic< RealNumberType >::myExp2, DGtal::Statistic< RealNumberType >::myMax, DGtal::Statistic< RealNumberType >::myMin, DGtal::Statistic< RealNumberType >::mySamples, DGtal::Statistic< RealNumberType >::myStoreSamples, and DGtal::Statistic< RealNumberType >::myValues.
|
inline |
Assignment.
other | the object to copy. |
Definition at line 94 of file Statistic.ih.
References DGtal::Statistic< RealNumberType >::myExp, DGtal::Statistic< RealNumberType >::myExp2, DGtal::Statistic< RealNumberType >::myIsTerminated, DGtal::Statistic< RealNumberType >::myMax, DGtal::Statistic< RealNumberType >::myMedian, DGtal::Statistic< RealNumberType >::myMin, DGtal::Statistic< RealNumberType >::mySamples, DGtal::Statistic< RealNumberType >::myStoreSamples, and DGtal::Statistic< RealNumberType >::myValues.
|
inline |
|
inline |
Writes/Displays the object on an output stream.
that_stream | the output stream where the object is written. |
Writes/Displays the object on an output stream.
thatStream | the output stream where the object is written. |
Definition at line 384 of file Statistic.ih.
Referenced by DGtal::operator<<().
|
inline |
Computes the median value of the statistics and switch to mode which does not save the statistics samples (myStore_samples = false). Usefull only if the values are stored (specified in the the constructor) else it doest nothing.
Computes the median value of the statistics and switch to mode which does not save the statistics samples (myStoreSamples = false). Usefull only if the values are stored (specified in the the constructor) else it doest nothing.
Definition at line 362 of file Statistic.ih.
Referenced by DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compare(), and DGtal::CompareLocalEstimators< TFirstEsimator, TSecondEstimator >::compareVectors().
|
inline |
Definition at line 221 of file Statistic.ih.
|
inline |
|
private |
stores the sum of sample values for computing sample mean.
Definition at line 232 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator+=(), and DGtal::Statistic< RealNumberType >::operator=().
|
private |
stores the sum of squared sample values for computing sample variance.
Definition at line 238 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator+=(), and DGtal::Statistic< RealNumberType >::operator=().
|
private |
Tells if terminate was called. Usefull to return median value even if the m_values are no more stored (possible after serialisation which doest store the values.).
Definition at line 276 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator=().
|
private |
stores the maximal sample value.
Definition at line 243 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator+=(), and DGtal::Statistic< RealNumberType >::operator=().
|
private |
stores the median sample value.
Definition at line 254 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator=().
|
private |
stores the minimal sample value.
Definition at line 248 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator+=(), and DGtal::Statistic< RealNumberType >::operator=().
|
private |
number of samples
Definition at line 227 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator+=(), and DGtal::Statistic< RealNumberType >::operator=().
|
private |
Tells if values must be stored or not.
Definition at line 267 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator+=(), and DGtal::Statistic< RealNumberType >::operator=().
|
private |
stores the sample to determine the median value
Definition at line 261 of file Statistic.h.
Referenced by DGtal::Statistic< RealNumberType >::operator+=(), DGtal::Statistic< RealNumberType >::operator=(), and DGtal::Statistic< RealNumberType >::Statistic().