C# Класс 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 );
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

GetRange() публичный Метод

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.
Результат IntRange

Histogram() публичный Метод

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.
Результат System

Update() публичный Метод

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
Результат void