Histogram

Shipping
array_histogram

Equal-width histogram of an array: bin counts and bin edges over [min, max]

Signature

Inputs

  • dataArrayrequiredAny array, flattened to 1-D and binned over its own [min, max].

Outputs

  • countsVectorCount in each of the `bins` equal-width buckets (length = bins).
  • edgesVectorThe bin edges (length = bins + 1).

Parameters

KeyTypeDefaultNotes
binsint10Number of equal-width buckets spanning $[\min, \max]$ of the data.

Description

Histogram buckets the flattened input into bins equal-width intervals spanning the data's own range and returns two vectors: counts (one value per bin) and edges (the bin boundaries). Because the range is derived from the data, the histogram always covers the full extent of the samples.

The edges vector has one more element than counts — bin spans . Downstream you can plot counts against edge midpoints, feed counts into Array Entropy or KL Divergence as an empirical distribution, or find the mode. The node is stateless.

Mathematics

Examples

Five-bin histogram

For with bins = 5: the range splits into width- buckets, so edges has 6 entries and each of the five samples lands in its own bin (counts sum to 5).

Applications

  • Visualizing a signal's amplitude distribution as a bar chart.
  • Building an empirical probability mass to feed Entropy / KL Divergence.
  • Detecting multi-modality or clipping in a data batch.

Neat

counts and edges follow the NumPy contract (edges = bins + 1), so the output drops straight into any histogram plotter or `numpy.histogram`-style consumer.

The auto-derived [min, max] range guarantees no sample falls outside the bins — the histogram is always complete for the input.

See also

histogrambinningdistributiondensitystateless