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

bundles / numpy latest / numpy / lib / _histograms_impl / _hist_bin_fd

function

numpy.lib._histograms_impl:_hist_bin_fd

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

Signature

def   _hist_bin_fd ( x range )

Summary

The Freedman-Diaconis histogram bin estimator.

Extended Summary

The Freedman-Diaconis rule uses interquartile range (IQR) to estimate binwidth. It is considered a variation of the Scott rule with more robustness as the IQR is less affected by outliers than the standard deviation. However, the IQR depends on fewer points than the standard deviation, so it is less accurate, especially for long tailed distributions.

If the IQR is 0, this function returns 0 for the bin width. Binwidth is inversely proportional to the cube root of data size (asymptotically optimal).

Parameters

x : array_like

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

Returns

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

Aliases

  • numpy.lib._histograms_impl._hist_bin_fd