MovingNormalStatistics Class |
Namespace: Accord.Statistics.Moving
[SerializableAttribute] public class MovingNormalStatistics : IMovingStatistics, IRunningStatistics, IRunning<double>, IMoving<double>, IEnumerable
The MovingNormalStatistics type exposes the following members.
Name | Description | |
---|---|---|
MovingNormalStatistics |
Initializes a new instance of the MovingNormalStatistics class.
|
Name | Description | |
---|---|---|
Count |
Gets the number of samples within the window.
| |
Mean |
Gets the mean of the values within the window.
| |
StandardDeviation |
Gets the standard deviation of the values within the window.
| |
Sum |
Gets the sum the values within the window.
| |
SumOfSquares |
Gets the sum of squared values within the window.
| |
Variance |
Gets the variance of the values within the window.
| |
Window |
Gets the size of the window.
|
Name | Description | |
---|---|---|
Clear |
Removes all elements from the window and resets statistics.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetEnumerator |
Returns an enumerator that iterates through the collection.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Push |
Pushes a value into the window.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
SetEqualsDouble |
Compares two enumerables for set equality. Two
enumerables are set equal if they contain the
same elements, but not necessarily in the same
order.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
// Moving Normal Statistics can be used to keep track of the mean, variance and standard // deviation of the last N samples that have been fed to it. It is possible to feed one // value at a time, and the class will keep track of the mean and variance of the samples // without registering the samples themselves. // An example where this class can be useful is when trying to filter the (x,y) trajectories // of a movement tracker (i.e. to show the average point on the past 10 frames) and monitor // the quality of the tracking (i.e. if the variance becomes too high, tracking might have been lost). // Fix seed for reproducible results Accord.Math.Random.Generator.Seed = 0; Random rnd = Accord.Math.Random.Generator.Random; // Create a estimator that will keep the mean and standard deviation of the past 5 samples: var normal = new MovingNormalStatistics(windowSize: 5); // Read 50 samples for (int i = 0; i < 50; i++) normal.Push(rnd.Next(1, 10)); // The properties of the 5 last samples are: double sum = normal.Sum; // 21 double mean = normal.Mean; // 4.2 double stdDev = normal.StandardDeviation; // 2.4899799195977463 double var = normal.Variance; // 6.2