#include <Stats.hxx>
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 89 of file 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. |
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 >::SetArray | ( | const Array< T > * | data | ) | [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 143 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute(), CLAM::StatsTmpl< abs >::GetMean(), and CLAM::StatsTmpl< abs >::GetMoment().
void CLAM::StatsTmpl< abs, T, U, initOrder >::GetMoments | ( | Array< U > & | moments, | |
const O< order > * | ||||
) | [inline] |
Get all raw moments up to the order indicated.
Definition at line 149 of file Stats.hxx.
Referenced by CLAM::Normalization::ComputeScaleFactorFromAvgEnergy(), CLAM::Normalization::ComputeScaleFactorFromDominantEnergy(), and CLAM::Normalization::ComputeScaleFactorFromMaxEnergy().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetCentralMoment | ( | const O< order > * | ) | [inline] |
Get order-th central 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 166 of file Stats.hxx.
Referenced by CLAM::StatsTmpl< abs >::GetCentralMoment(), and CLAM::StatsTmpl< abs >::GetVariance().
void CLAM::StatsTmpl< abs, T, U, initOrder >::GetCentralMoments | ( | Array< U > & | centralMoments, | |
const O< order > * | ||||
) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetCenterOfGravity | ( | const O< order > * | ) | [inline] |
Get order-th center of gravity.
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 190 of file Stats.hxx.
Referenced by CLAM::StatsTmpl< abs >::GetCenterOfGravity().
void CLAM::StatsTmpl< abs, T, U, initOrder >::GetCenterOfGravities | ( | Array< U > & | centerOfGravities, | |
const O< order > * | ||||
) | [inline] |
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetMean | ( | ) | [inline] |
Get mean, compute it if necessary.
Definition at line 216 of file Stats.hxx.
Referenced by CLAM::SpectralPeakDescriptors::ConcreteCompute(), CLAM::SpectralDescriptors::ConcreteCompute(), CLAM::AudioDescriptors::ConcreteCompute(), CLAM::StatsTmpl< abs >::GetCentroid(), and CLAM::StatsTmpl< abs >::GetFlatness().
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 241 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute(), CLAM::AudioDescriptors::ConcreteCompute(), CLAM::StatsTmpl< abs >::GetSlope(), and CLAM::StatsTmpl< abs >::GetSpread().
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
Definition at line 298 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 >::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 355 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 383 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
U CLAM::StatsTmpl< abs, T, U, initOrder >::GetVariance | ( | ) | [inline] |
Get variance, compute it if necessary.
The variance is the mean cuadratic distance from the mean.
Definition at line 398 of file Stats.hxx.
Referenced by CLAM::AudioDescriptors::ConcreteCompute().
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetEnergy | ( | ) | [inline] |
Get energy, compute it if necessary.
Definition at line 411 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ComputeLowFreqEnergyRelation(), CLAM::SpectralDescriptors::ComputeRolloff(), CLAM::Normalization::ComputeScaleFactorFromAvgEnergy(), CLAM::Normalization::ComputeScaleFactorFromDominantEnergy(), CLAM::Normalization::ComputeScaleFactorFromMaxEnergy(), CLAM::SpectralDescriptors::ConcreteCompute(), and CLAM::AudioDescriptors::ConcreteCompute().
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 433 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute(), and CLAM::StatsTmpl< abs >::GetFlatness().
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetRMS | ( | ) | [inline] |
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetMax | ( | ) | [inline] |
T CLAM::StatsTmpl< abs, T, U, initOrder >::GetMin | ( | ) | [inline] |
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 495 of file Stats.hxx.
Referenced by 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 552 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ComputeSpectralFlatness().
void CLAM::StatsTmpl< abs, T, U, initOrder >::Reset | ( | void | ) | [inline] |
Reset all the cached computations.
This method is called automatically if you change the data pointer using the SetData method, but it should be called explicitly whenever the values on that array changes externally.
Definition at line 567 of file Stats.hxx.
Referenced by CLAM::StatsTmpl< abs >::SetArray().