MCPcopy Create free account
hub / github.com/numpy/numpy / _hist_bin_scott

Function _hist_bin_scott

numpy/lib/histograms.py:100–119  ·  view source on GitHub ↗

Scott histogram bin estimator. The binwidth is proportional to the standard deviation of the data and inversely proportional to the cube root of data size (asymptotically optimal). Parameters ---------- x : array_like Input data that is to be histogrammed, trim

(x, range)

Source from the content-addressed store, hash-verified

98
99
100def _hist_bin_scott(x, range):
101 """
102 Scott histogram bin estimator.
103
104 The binwidth is proportional to the standard deviation of the data
105 and inversely proportional to the cube root of data size
106 (asymptotically optimal).
107
108 Parameters
109 ----------
110 x : array_like
111 Input data that is to be histogrammed, trimmed to range. May not
112 be empty.
113
114 Returns
115 -------
116 h : An estimate of the optimal bin width for the given data.
117 """
118 del range # unused
119 return (24.0 * np.pi**0.5 / x.size)**(1.0 / 3.0) * np.std(x)
120
121
122def _hist_bin_stone(x, range):

Callers

nothing calls this directly

Calls 1

stdMethod · 0.45

Tested by

no test coverage detected