- jax.numpy.histogram_bin_edges(a, bins=10, range=None, weights=None)#
Function to calculate only the edges of the bins used by the histogram
LAX-backend implementation of
Original docstring below.
a (array_like) – Input data. The histogram is computed over the flattened array.
If bins is an int, it defines the number of equal-width bins in the given range (10, by default). If bins is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths.
If bins is a string from the list below, histogram_bin_edges will use the method chosen to calculate the optimal bin width and consequently the number of bins (see Notes for more detail on the estimators) from the data that falls within the requested range. While the bin width will be optimal for the actual data in the range, the number of bins will be computed to fill the entire range, including the empty portions. For visualisation, using the ‘auto’ option is suggested. Weighted data is not supported for automated bin size selection.
Maximum of the ‘sturges’ and ‘fd’ estimators. Provides good all around performance.
- ’fd’ (Freedman Diaconis Estimator)
Robust (resilient to outliers) estimator that takes into account data variability and data size.
An improved version of Sturges’ estimator that works better with non-normal datasets.
Less robust estimator that takes into account data variability and data size.
Estimator based on leave-one-out cross-validation estimate of the integrated squared error. Can be regarded as a generalization of Scott’s rule.
Estimator does not take variability into account, only data size. Commonly overestimates number of bins required.
R’s default method, only accounts for data size. Only optimal for gaussian data and underestimates number of bins for large non-gaussian datasets.
Square root (of data size) estimator, used by Excel and other programs for its speed and simplicity.
range ((float, float), optional) – The lower and upper range of the bins. If not provided, range is simply
(a.min(), a.max()). Values outside the range are ignored. The first element of the range must be less than or equal to the second. range affects the automatic bin computation as well. While bin width is computed to be optimal based on the actual data within range, the bin count will fill the entire range including portions containing no data.
weights (array_like, optional) – An array of weights, of the same shape as a. Each value in a only contributes its associated weight towards the bin count (instead of 1). This is currently not used by any of the bin estimators, but may be in the future.
bin_edges – The edges to pass into histogram
- Return type
array of dtype float