CLAM-Development
1.4.0
|
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 |
|
inline |
|
inline |
|
inline |
|
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< false, FrameDescriptors, FrameDescriptors >::GetCenterOfGravity().
|
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< false, FrameDescriptors, FrameDescriptors >::GetCentralMoment(), and CLAM::StatsTmpl< false, FrameDescriptors, FrameDescriptors >::GetVariance().
|
inline |
|
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::AudioDescriptors::ConcreteCompute(), CLAM::SpectralDescriptors::ConcreteCompute(), CLAM::StatsTmpl< false, FrameDescriptors, FrameDescriptors >::GetSlope(), and CLAM::StatsTmpl< false, FrameDescriptors, FrameDescriptors >::GetSpread().
|
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::AudioDescriptors::ConcreteCompute(), and CLAM::SpectralDescriptors::ConcreteCompute().
|
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().
|
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< false, FrameDescriptors, FrameDescriptors >::GetFlatness().
|
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().
|
inline |
Get maximum value.
Definition at line 451 of file Stats.hxx.
Referenced by CLAM::SegmentDescriptors::ConcreteCompute().
|
inline |
Get mean, compute it if necessary.
Definition at line 216 of file Stats.hxx.
Referenced by CLAM::SegmentDescriptors::ConcreteCompute(), CLAM::AudioDescriptors::ConcreteCompute(), CLAM::SpectralPeakDescriptors::ConcreteCompute(), CLAM::SpectralDescriptors::ConcreteCompute(), CLAM::StatsTmpl< false, FrameDescriptors, FrameDescriptors >::GetCentroid(), and CLAM::StatsTmpl< false, FrameDescriptors, FrameDescriptors >::GetFlatness().
|
inline |
Get minimum value.
Definition at line 457 of file Stats.hxx.
Referenced by CLAM::SegmentDescriptors::ConcreteCompute().
|
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< false, FrameDescriptors, FrameDescriptors >::GetMean(), and CLAM::StatsTmpl< false, FrameDescriptors, FrameDescriptors >::GetMoment().
|
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().
|
inline |
|
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().
|
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().
|
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 298 of file Stats.hxx.
Referenced by CLAM::SpectralDescriptors::ConcreteCompute().
|
inline |
|
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::SegmentDescriptors::ConcreteCompute(), and CLAM::AudioDescriptors::ConcreteCompute().
|
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< false, FrameDescriptors, FrameDescriptors >::SetArray().
|
inline |
Method to change data array and reset all previous computations.
Definition at line 131 of file Stats.hxx.
Referenced by CLAM::SegmentDescriptors::SetpSegment().