IterativeMoments¶
- class IterativeMoments(*args)¶
Iterative moments.
- Parameters:
- orderint
Maximum order of the moments wanted
- dimensionint
Dimension of the input data
See also
Notes
This class iteratively computes the central moments of an iteratively increasing dataset without storing any data in memory.
Examples
In the following example, we iteratively compute the sample statistics of a sample. This is based on a sample with size equal to 2000. In the for loop, each realization of the distribution is used to update the statistics up to the 4th order moments.
>>> import openturns as ot >>> distNormal = ot.Normal() >>> order = 4 >>> dim = 1 >>> iterMoments = ot.IterativeMoments(order, dim) >>> size = 2000 >>> meanEvolution = ot.Sample() >>> for i in range(size): ... point = distNormal.getRealization() ... iterMoments.increment(point) >>> print('Mean: ', iterMoments.getMean()) Mean: [-0.00726852] >>> print('Variance: ', iterMoments.getVariance()) Variance: [0.99156] >>> print('Skewness: ', iterMoments.getSkewness()) Skewness: [0.0577277] >>> print('Kurtosis: ', iterMoments.getKurtosis()) Kurtosis: [3.11128]
The statistics can also be updated with a single sample.
>>> distNormal = ot.Normal() >>> dim = 1 >>> order = 1 >>> iterMoments = ot.IterativeMoments(order, dim) >>> size = 2000 >>> sample = distNormal.getSample(size) >>> iterMoments.increment(sample) >>> print('Mean: ', iterMoments.getMean()) Mean: [-0.017342]
Methods
Returns the central moments
Accessor to the object's name.
Returns the coefficient of variation
Get the dimension of the algorithm
getId
()Accessor to the object's id.
Get the current iteration of the algorithm
Returns the current value of the unbiased estimator of the kurtosis
getMean
()Returns the values of the mean
getName
()Accessor to the object's name.
getOrder
()Returns the maximum order prescribed
Accessor to the object's shadowed id.
Returns the current value of the unbiased estimator of the skewness
Returns the standard deviation
Returns the standard error of the mean
Returns the current value of the unbiased estimator of the variance
Accessor to the object's visibility state.
hasName
()Test if the object is named.
Test if the object has a distinguishable name.
increment
(*args)Increment the internal data.
setName
(name)Accessor to the object's name.
setShadowedId
(id)Accessor to the object's shadowed id.
setVisibility
(visible)Accessor to the object's visibility state.
getCenteredMoments
- __init__(*args)¶
- getCentralMoments()¶
Returns the central moments
- Returns:
- centralMoments
Sample
Current value of the central moments.
- centralMoments
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getCoefficientOfVariation()¶
Returns the coefficient of variation
- Returns:
- coefficientOfvariation
Point
Current value of the coefficients of variation.
- coefficientOfvariation
- getDimension()¶
Get the dimension of the algorithm
- Returns:
- dimensionint
Dimension of the algorithm
- getId()¶
Accessor to the object’s id.
- Returns:
- idint
Internal unique identifier.
- getIterationNumber()¶
Get the current iteration of the algorithm
- Returns:
- iterationint
Current iteration of the algorithm
- getKurtosis()¶
Returns the current value of the unbiased estimator of the kurtosis
- Returns:
- kurtosis
Point
Current values of the iterative kurtosis.
- kurtosis
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getOrder()¶
Returns the maximum order prescribed
- Returns:
- orderint
Prescribed order of the iterative object.
- getShadowedId()¶
Accessor to the object’s shadowed id.
- Returns:
- idint
Internal unique identifier.
- getSkewness()¶
Returns the current value of the unbiased estimator of the skewness
- Returns:
- skewness
Point
Current values of the skewness.
- skewness
- getStandardDeviation()¶
Returns the standard deviation
- Returns:
- standardDeviation
Point
Current value of the standard deviation.
- standardDeviation
- getStandardErrorOfTheMean()¶
Returns the standard error of the mean
- Returns:
- error
Point
Current value of the standard error of the mean.
- error
- getVariance()¶
Returns the current value of the unbiased estimator of the variance
- Returns:
- variance
Point
Current values of the variance.
- variance
- getVisibility()¶
Accessor to the object’s visibility state.
- Returns:
- visiblebool
Visibility flag.
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- hasVisibleName()¶
Test if the object has a distinguishable name.
- Returns:
- hasVisibleNamebool
True if the name is not empty and not the default one.
- increment(*args)¶
Increment the internal data.
- Parameters:
- datasequence of float or 2-d sequence of float
New input point or sample.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setShadowedId(id)¶
Accessor to the object’s shadowed id.
- Parameters:
- idint
Internal unique identifier.
- setVisibility(visible)¶
Accessor to the object’s visibility state.
- Parameters:
- visiblebool
Visibility flag.