Calculate mode value.

Namespace:  AForge.Math
Assembly:  AForge.Math (in AForge.Math.dll) Version: 2.2.5.0 (2.2.5.0)

Syntax

C#
public static int Mode(
	int[] values
)

Parameters

values
Type: array< System..::.Int32 >[]()[]
Histogram array.

Return Value

Returns mode value of the histogram array.

Remarks

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

Note:Returns the minimum mode value if the specified histogram is multimodal.

Sample usage:

CopyC#
// create array
int[] values = new int[] { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 };
// calculate mode value
int mode = Statistics.Mode( values );
// output it (7)
Console.WriteLine( "mode = " + mode );

See Also