Class to hold basic statistics related to an array of arbitrary data. More...
#include <Stats.hxx>
Public Member Functions | |
StatsTmpl (const Array< T > *data) | |
~StatsTmpl () | |
void | SetArray (const Array< T > *data) |
Method to change data array and reset all previous computations. | |
template<int order> | |
U | GetMoment (const O< order > *) |
Get order-th raw moment. | |
template<int order> | |
void | GetMoments (Array< U > &moments, const O< order > *) |
Get all raw moments up to the order indicated. | |
template<int order> | |
U | GetCentralMoment (const O< order > *) |
Get order-th central moment. | |
template<int order> | |
void | GetCentralMoments (Array< U > ¢ralMoments, const O< order > *) |
Get all central moments up to the order indicated. | |
template<int order> | |
U | GetCenterOfGravity (const O< order > *) |
Get order-th center of gravity. | |
template<int order> | |
void | GetCenterOfGravities (Array< U > ¢erOfGravities, const O< order > *) |
Get all center of gravities up to the order indicated. | |
U | GetMean () |
Get mean, compute it if necessary. | |
U | GetCentroid () |
Get centroid, compute it if necessary. | |
U | GetSpread () |
Computes and returns the Spread arround the Centroid. | |
U | GetStandardDeviation () |
Get standard deviation, compute it if necessary. | |
U | GetSkew () |
Get skewness coefficient, compute it if necessary. | |
U | GetKurtosis () |
Get kurtosis, compute it if necessary. | |
U | GetVariance () |
Get variance, compute it if necessary. | |
T | GetEnergy () |
Get energy, compute it if necessary. | |
U | GetGeometricMean () |
Get the Geometric mean, and computes it if necessary. | |
T | GetRMS () |
Get the root means square (RMS), compute it if necessary. | |
T | GetMax () |
Get maximum value. | |
T | GetMin () |
Get minimum value. | |
U | GetSlope () |
Computes and returns the Slope. | |
U | GetFlatness () |
Get flatness, compute it if necessary. | |
void | Reset () |
Reset all the cached computations. |
Class to hold basic statistics related to an array of arbitrary data.
Statistics are computed efficiently and reusing computations whenever possible.
abs | whether the statistics are performed directly on the values (by default or template parameter=false) or on the absolute value of the array elements | |
T | the array type | |
U | the type of the resulting statistics |
Definition at line 86 of file Stats.hxx.
CLAM::StatsTmpl< abs, T, U, initOrder >::StatsTmpl | ( | const Array< T > * | data | ) | [inline] |
CLAM::StatsTmpl< abs, T, U, initOrder >::~StatsTmpl | ( | ) | [inline] |
void CLAM::StatsTmpl< abs, T, U, initOrder >::GetCenterOfGravities | ( | Array< U > & | centerOfGravities, | |
const O< order > * | ||||
) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetCenterOfGravity | ( | const O< order > * | ) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetCentralMoment | ( | const O< order > * | ) | [inline] |
void CLAM::StatsTmpl< abs, T, U, initOrder >::GetCentralMoments | ( | Array< U > & | centralMoments, | |
const O< order > * | ||||
) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetCentroid | ( | ) | [inline] |
Get centroid, compute it if necessary.
The centroid of a function returns the position around which most higher values are concentrated.
whenever the Mean(X) is less than 1e-7, then it will return the mid position
Definition at line 238 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetEnergy | ( | ) | [inline] |
Get energy, compute it if necessary.
Definition at line 408 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ComputeLowFreqEnergyRelation(), CLAM::SpectralDescriptors::ComputeRolloff(), and CLAM::SpectralDescriptors::ConcreteCompute().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetFlatness | ( | ) | [inline] |
Get flatness, compute it if necessary.
The flatness is the relation among the geometric mean and the arithmetic mean.
Singularities and solution:
Definition at line 549 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ComputeSpectralFlatness().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetGeometricMean | ( | ) | [inline] |
Get the Geometric mean, and computes it if necessary.
The Geometric mean gives the mean magnitude order. It converges with the mean when all the values are closer.
In order to make the computation cheap, For easy computation, logarithms are used.
Definition at line 430 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetKurtosis | ( | ) | [inline] |
Get kurtosis, compute it if necessary.
The Kurtosis of a distribution gives an idea of the degree of pickness of the distribution.
Tipical values:
Singularities and solutions:
Definition at line 380 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetMax | ( | ) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetMean | ( | ) | [inline] |
Get mean, compute it if necessary.
Definition at line 213 of file Stats.hxx.
Referenced by CLAM::SpectralPeakDescriptors::ConcreteCompute(), and CLAM::SpectralDescriptors::ConcreteCompute().
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetMin | ( | ) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetMoment | ( | const O< order > * | ) | [inline] |
Get order-th raw moment.
This method just acts as a selector, if order is greater than init order, we cannot assure that the pointer has been initialized and we need extra checks (slow downs).
Definition at line 140 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
void CLAM::StatsTmpl< abs, T, U, initOrder >::GetMoments | ( | Array< U > & | moments, | |
const O< order > * | ||||
) | [inline] |
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetRMS | ( | ) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetSkew | ( | ) | [inline] |
Get skewness coefficient, compute it if necessary.
The Skewness of a distribution gives an idea of the assimetry of the variance of the values.
Tipical values:
Singularities and solutions:
Definition at line 352 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetSlope | ( | ) | [inline] |
Computes and returns the Slope.
The slope gives an idea of the mean pendent on the array:
The Slope is defined as:
We can transform this formula into one depending on the Centroid which is already calculated in order to obtain other stats:
The slope is relative to the array position index. If you want to give to the array position a dimentional meaning, (p.e. frequency or time) then you should divide by the gap between array positions. for example GetSlope/BinFreq for a FFT or GetSlope*SampleRate for an audio
Definition at line 492 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetSpread | ( | ) | [inline] |
Computes and returns the Spread arround the Centroid.
The spread gives an idea on how much the distribution is NOT concentrated over the distribution centroid. Taking the array as a distribution and the values being probabilities, the spread would be the variance of such distribution.
Significant values:
Singularities and solution:
Normalization: Multiply the result by the square of the gap between arrays positions. ex. in an array representing a spectrum multiply by
still not tested as stats but tested its usage for SpectralSpread
should use other stats than centroid to save computations
Definition at line 295 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetStandardDeviation | ( | ) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetVariance | ( | ) | [inline] |
void CLAM::StatsTmpl< abs, T, U, initOrder >::Reset | ( | void | ) | [inline] |
void CLAM::StatsTmpl< abs, T, U, initOrder >::SetArray | ( | const Array< T > * | data | ) | [inline] |