jax.numpy.histogram_bin_edges#

jax.numpy.histogram_bin_edges(a, bins=10, range=None, weights=None)[source]#

Compute the bin edges for a histogram.

JAX implementation of numpy.histogram_bin_edges().

Parameters:
  • a (ArrayLike) – array of values to be binned

  • bins (ArrayLike) – Specify the number of bins in the histogram (default: 10).

  • range (None | Array | Sequence[ArrayLike] | None) – tuple of scalars. Specifies the range of the data. If not specified, the range is inferred from the data.

  • weights (ArrayLike | None | None) – unused by JAX.

Returns:

An array of bin edges for the histogram.

Return type:

Array

See also

Examples

>>> a = jnp.array([2, 5, 3, 6, 4, 1])
>>> jnp.histogram_bin_edges(a, bins=5)
Array([1., 2., 3., 4., 5., 6.], dtype=float32)
>>> jnp.histogram_bin_edges(a, bins=5, range=(-10, 10))  
Array([-10.,  -6.,  -2.,   2.,   6.,  10.], dtype=float32)