summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorguoci <zguoci@gmail.com>2018-11-20 13:29:24 -0500
committerguoci <zguoci@gmail.com>2018-11-20 13:29:24 -0500
commitb0b07cabd11510e03cc42d6f66ecebb6eb5f10a4 (patch)
tree31f53c5441f6941c2844b5bf833ed27310cfc635 /numpy/lib
parentc3c6cd5e70e1f10ce374fb580debc846922a9232 (diff)
downloadnumpy-b0b07cabd11510e03cc42d6f66ecebb6eb5f10a4.tar.gz
resolve issues from review
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/histograms.py7
-rw-r--r--numpy/lib/tests/test_histograms.py4
2 files changed, 7 insertions, 4 deletions
diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py
index 6666d8628..482eabe14 100644
--- a/numpy/lib/histograms.py
+++ b/numpy/lib/histograms.py
@@ -111,7 +111,7 @@ def _hist_bin_scott(x, range):
return (24.0 * np.pi**0.5 / x.size)**(1.0 / 3.0) * np.std(x)
-def _hist_bin_ise(x, range):
+def _hist_bin_stone(x, range):
"""
Histogram bin estimator based on minimizing the estimated integrated squared error (ISE).
@@ -119,6 +119,9 @@ def _hist_bin_ise(x, range):
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.
+ http://digitalassets.lib.berkeley.edu/sdtr/ucb/text/34.pdf
+
Parameters
----------
x : array_like
@@ -258,7 +261,7 @@ def _hist_bin_auto(x, range):
return sturges_bw
# Private dict initialized at module load time
-_hist_bin_selectors = {'stone': _hist_bin_ise,
+_hist_bin_selectors = {'stone': _hist_bin_stone,
'auto': _hist_bin_auto,
'doane': _hist_bin_doane,
'fd': _hist_bin_fd,
diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py
index 67a94877d..49c0d9720 100644
--- a/numpy/lib/tests/test_histograms.py
+++ b/numpy/lib/tests/test_histograms.py
@@ -544,8 +544,8 @@ class TestHistogramOptimBinNums(object):
a, b = np.histogram(outlier_dataset, estimator)
assert_equal(len(a), numbins)
- def test_scott_vs_ise(self):
- """Verify that Scott's rule and the ISE based method converges for normally distributed data"""
+ def test_scott_vs_stone(self):
+ """Verify that Scott's rule and Stone's rule converges for normally distributed data"""
def nbins_ratio(seed, size):
rng = np.random.RandomState(seed)