bundles / numpy 2.4.4 / numpy / lib / _histograms_impl / _hist_bin_auto
function
numpy.lib._histograms_impl:_hist_bin_auto
Signature
def _hist_bin_auto ( x , range ) Summary
Histogram bin estimator that uses the minimum width of a relaxed Freedman-Diaconis and Sturges estimators if the FD bin width does not result in a large number of bins. The relaxed Freedman-Diaconis estimator limits the bin width to half the sqrt estimated to avoid small bins.
Extended Summary
The FD estimator is usually the most robust method, but its width estimate tends to be too large for small x and bad for data with limited variance. The Sturges estimator is quite good for small (<1000) datasets and is the default in the R language. This method gives good off-the-shelf behaviour.
Parameters
x: array_likeInput data that is to be histogrammed, trimmed to range. May not be empty.
range: Tuple with range for the histogram
Returns
h: An estimate of the optimal bin width for the given data.
See also
Aliases
-
numpy.lib._histograms_impl._hist_bin_auto