hist

Parameters

Parameter label

I/O type

Data type

Mandatory parameter?

Default value

inputVec

input

vector

yes

bins

input

scalar/vector

no

None

histogramType

input

string ("nominal"/"metrical"/"ordinal")

yes

N/A

min

input

scalar

no

None

max

input

scalar

no

None

density

input

bool

no

False

removeEmptyBins

input

bool

no

False

histVec

output

vector

N/A

N/A

bins

output

vector

N/A

N/A

Functionality

Module computes different types of histograms over the input vector inputVec.

Nominal histogram (histogramType="nominal")

This type of histogram can be computed on non-numerical input data such as characters, character sequences, lists of lists, etc. Here are some examples (taken from the module’s unit test):

inputVec = ['AABCCCD']
inputVec = ['AB','BC','CC','CC','AB','AB']
inputVec = [[-1,1],[-1,1],[1,2],[1,3]]
inputVec = [(1.5,1),(1.5,1),(1.5,2),(2,3)]

The output parameter bins contains all unique elements in inputVec. The output parameter histVec contains the number of appearances of each unique element in inputVec.

Ordinal histogram (histogramType="ordinal")

This type of histogram can be computed on numerical input vectors such as

inputVec = numpy.array([1,2,2,3,3,3,5,5,5,5,5])

The histogram bins given in the input parameter bins are interpreted as unique values, whose number or appearance will be counted and stored in the output parameter histVec.

If not given explicitly, the histogram bins are defined within a specific range between the a minimum or maximum value. These two values are either defined by the input parameters min and max or automatically computed from the minimum and maximum of inputVec.

If removeEmptyBins is set to True, empty bins are removed from both output vectors.

If density is set to True, the output parameters histVec is normalized to unit sum and can be used as density.

Metrical histogram (histogramType="metrical")

Similar to the ordinal histogram, the metrical histogram can be computed on numerical input vectors such as

inputVec = numpy.array([1,2,2,3,3,3,5,5,5,5,5])

The values in bins define edges of the histogram bins. The number of values in inputVec in between the all pairs of edges are counted in histVec.

If density is set to True, the output parameters histVec is normalized to unit sum and can be used as density.