This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / lib / _histograms_impl / _hist_bin_stone

function

numpy.lib._histograms_impl:_hist_bin_stone

source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_histograms_impl.py :122

Signature

def   _hist_bin_stone ( x range )

Summary

Histogram bin estimator based on minimizing the estimated integrated squared error (ISE).

Extended Summary

The number of bins is chosen by minimizing the estimated ISE against the unknown true distribution. The ISE is estimated using cross-validation and can be regarded as a generalization of Scott's rule. https://en.wikipedia.org/wiki/Histogram#Scott.27s_normal_reference_rule

This paper by Stone appears to be the origination of this rule. https://digitalassets.lib.berkeley.edu/sdtr/ucb/text/34.pdf

Parameters

x : array_like

Input data that is to be histogrammed, trimmed to range. May not be empty.

range : (float, float)

The lower and upper range of the bins.

Returns

h : An estimate of the optimal bin width for the given data.

Aliases

  • numpy.lib._histograms_impl._hist_bin_stone