C# Class AForge.Math.Histogram

Histogram for discrete random values.

The class wraps histogram for discrete stochastic function, which is represented by integer array, where indexes of the array are treated as values of the stochastic function, but array values are treated as "probabilities" (total amount of hits).

Sample usage:

// create histogram Histogram histogram = new Histogram( new int[10] { 0, 0, 1, 3, 6, 8, 11, 0, 0, 0 } ); // get mean and standard deviation values Console.WriteLine( "mean = " + histogram.Mean + ", std.dev = " + histogram.StdDev );
Datei anzeigen Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Public Methods

Method Description
GetRange ( double percent ) : IntRange

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 Histogram histogram = new Histogram( new int[10] { 0, 0, 1, 3, 6, 8, 11, 0, 0, 0 } ); // get 50% range IntRange range = histogram.GetRange( 0.5 ); // show the range ([4, 6]) Console.WriteLine( "50% range = [" + range.Min + ", " + range.Max + "]" );
Histogram ( int values ) : System

Initializes a new instance of the Histogram class.

Indexes of the input array are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

Update ( ) : void

Update statistical value of the histogram.

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

Method Details

GetRange() public method

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 Histogram histogram = new Histogram( new int[10] { 0, 0, 1, 3, 6, 8, 11, 0, 0, 0 } ); // get 50% range IntRange range = histogram.GetRange( 0.5 ); // show the range ([4, 6]) Console.WriteLine( "50% range = [" + range.Min + ", " + range.Max + "]" );
public GetRange ( double percent ) : IntRange
percent double Values percentage around median.
return IntRange

Histogram() public method

Initializes a new instance of the Histogram class.

Indexes of the input array are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

public Histogram ( int values ) : System
values int Values of the histogram.
return System

Update() public method

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