MCPcopy
hub / github.com/numpy/numpy / _hist_bin_sturges

Function _hist_bin_sturges

numpy/lib/_histograms_impl.py:53–73  ·  view source on GitHub ↗

Sturges histogram bin estimator. A very simplistic estimator based on the assumption of normality of the data. This estimator has poor performance for non-normal data, which becomes especially obvious for large data sets. The estimate depends only on size of the data. Para

(x, range)

Source from the content-addressed store, hash-verified

51
52
53def _hist_bin_sturges(x, range):
54 """
55 Sturges histogram bin estimator.
56
57 A very simplistic estimator based on the assumption of normality of
58 the data. This estimator has poor performance for non-normal data,
59 which becomes especially obvious for large data sets. The estimate
60 depends only on size of the data.
61
62 Parameters
63 ----------
64 x : array_like
65 Input data that is to be histogrammed, trimmed to range. May not
66 be empty.
67
68 Returns
69 -------
70 h : An estimate of the optimal bin width for the given data.
71 """
72 del range # unused
73 return _ptp(x) / (np.log2(x.size) + 1.0)
74
75
76def _hist_bin_rice(x, range):

Callers 1

_hist_bin_autoFunction · 0.85

Calls 1

_ptpFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…