C# Class AForge.Math.ContinuousHistogram

Histogram for continuous random values.

The class wraps histogram for continuous stochastic function, which is represented by integer array and range of the function. Values of the integer array are treated as total amount of hits on the corresponding subranges, which are calculated by splitting the specified range into required amount of consequent ranges.

For example, if the integer array is equal to { 1, 2, 4, 8, 16 } and the range is set to [0, 1], then the histogram consists of next subranges: [0.0, 0.2] - 1 hit; [0.2, 0.4] - 2 hits; [0.4, 0.6] - 4 hits; [0.6, 0.8] - 8 hits; [0.8, 1.0] - 16 hits.

Sample usage:

// create histogram ContinuousHistogram histogram = new ContinuousHistogram( new int[] { 0, 0, 8, 4, 2, 4, 7, 1, 0 }, new DoubleRange( 0.0, 1.0 ) ); // get mean and standard deviation values System.Diagnostics.Debug.WriteLine( "mean = " + histogram.Mean + ", std.dev = " + histogram.StdDev );
Afficher le fichier Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Méthodes publiques

Méthode Description
ContinuousHistogram ( int values, AForge.Math.Range range ) : System

Initializes a new instance of the ContinuousHistogram class.

Values of the integer array are treated as total amount of hits on the corresponding subranges, which are calculated by splitting the specified range into required amount of consequent ranges (see ContinuousHistogram class description for more information).

GetRange ( float percent ) : AForge.Math.Range

Get range around median containing specified percentage of values.

The method calculates range of stochastic variable, which summary probability comprises the specified percentage of histogram's hits.

Sample usage:

// create histogram ContinuousHistogram histogram = new ContinuousHistogram( new int[] { 0, 0, 8, 4, 2, 4, 7, 1, 0 }, new Range( 0.0f, 1.0f ) ); // get 50% range Range range = histogram.GetRange( 0.5f ); // show the range ([0.25, 0.75]) Console.WriteLine( "50% range = [" + range.Min + ", " + range.Max + "]" );
Update ( ) : void

Update statistical value of the histogram.

The method recalculates statistical values of the histogram, like mean, standard deviation, etc. The method should be called only in the case if histogram values were retrieved through Values property and updated after that.

Method Details

ContinuousHistogram() public méthode

Initializes a new instance of the ContinuousHistogram class.
Values of the integer array are treated as total amount of hits on the corresponding subranges, which are calculated by splitting the specified range into required amount of consequent ranges (see ContinuousHistogram class description for more information).
public ContinuousHistogram ( int values, AForge.Math.Range range ) : System
values int Values of the histogram.
range AForge.Math.Range Range of random values.
Résultat System

GetRange() public méthode

Get range around median containing specified percentage of values.

The method calculates range of stochastic variable, which summary probability comprises the specified percentage of histogram's hits.

Sample usage:

// create histogram ContinuousHistogram histogram = new ContinuousHistogram( new int[] { 0, 0, 8, 4, 2, 4, 7, 1, 0 }, new Range( 0.0f, 1.0f ) ); // get 50% range Range range = histogram.GetRange( 0.5f ); // show the range ([0.25, 0.75]) Console.WriteLine( "50% range = [" + range.Min + ", " + range.Max + "]" );
public GetRange ( float percent ) : AForge.Math.Range
percent float Values percentage around median.
Résultat AForge.Math.Range

Update() public méthode

Update statistical value of the histogram.
The method recalculates statistical values of the histogram, like mean, standard deviation, etc. The method should be called only in the case if histogram values were retrieved through Values property and updated after that.
public Update ( ) : void
Résultat void