<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 13, 2015 at 5:02 AM, Neil Girdhar <span dir="ltr"><<a href="mailto:mistersheik@gmail.com" target="_blank">mistersheik@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can I suggest that we instead add the P-square algorithm for the dynamic calculation of histograms?  (<a href="http://pierrechainais.ec-lille.fr/Centrale/Option_DAD/IMPACT_files/Dynamic%20quantiles%20calcultation%20-%20P2%20Algorythm.pdf" target="_blank">http://pierrechainais.ec-lille.fr/Centrale/Option_DAD/IMPACT_files/Dynamic%20quantiles%20calcultation%20-%20P2%20Algorythm.pdf</a>)</div></blockquote><div><br></div><div>This look slike a great thing to have in numpy. However, I suspect that a lot of the downstream code that uses histogram expects equally-spaced bins.</div><div><br></div><div>So this should probably be a "in addition to", rather than an "instead of"</div><div><br></div><div>-CHB</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>This is already implemented in C++'s boost library (<a href="http://www.boost.org/doc/libs/1_44_0/boost/accumulators/statistics/extended_p_square.hpp" target="_blank">http://www.boost.org/doc/libs/1_44_0/boost/accumulators/statistics/extended_p_square.hpp</a>)</div><div><br></div><div>I implemented it in Boost Python as a module, which I'm happy to share.  This is much better than fixed-width histograms in practice.  Rather than adjusting the number of bins, it adjusts what you really want, which is the resolution of the bins throughout the domain.</div><div><br></div><div>Best,</div><div><br></div><div>Neil</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 12, 2015 at 4:02 AM, Ralf Gommers <span dir="ltr"><<a href="mailto:ralf.gommers@gmail.com" target="_blank">ralf.gommers@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Sun, Apr 12, 2015 at 9:45 AM, Jaime Fernández del Río <span dir="ltr"><<a href="mailto:jaime.frio@gmail.com" target="_blank">jaime.frio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Sun, Apr 12, 2015 at 12:19 AM, Varun <span dir="ltr"><<a href="mailto:nayyarv@gmail.com" target="_blank">nayyarv@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><a href="http://nbviewer.ipython.org/github/nayyarv/matplotlib/blob/master/examples/statistics/A" target="_blank">http://nbviewer.ipython.org/github/nayyarv/matplotlib/blob/master/examples/sta<br>
tistics/A</a> utomating%20Binwidth%20Choice%20for%20Histogram.ipynb<br>
<br>
Long story short, histogram visualisations that depend on numpy (such as<br>
matplotlib, or  nearly all of them) have poor default behaviour as I have to<br>
constantly play around with  the number of bins to get a good idea of what I'm<br>
looking at. The bins=10 works ok for  up to 1000 points or very normal data,<br>
but has poor performance for anything else, and  doesn't account for<br>
variability either. I don't have a method easily available to scale the number<br>
of bins given the data.<br>
<br>
R doesn't suffer from these problems and provides methods for use with it's<br>
hist  method. I would like to provide similar functionality for matplotlib, to<br>
at least provide  some kind of good starting point, as histograms are very<br>
useful for initial data discovery.<br>
<br>
The notebook above provides an explanation of the problem as well as some<br>
proposed  alternatives. Use different datasets (type and size) to see the<br>
performance of the  suggestions. All of the methods proposed exist in R and<br>
literature.<br>
<br>
I've put together an implementation to add this new functionality, but am<br>
hesitant to  make a pull request as I would like some feedback from a<br>
maintainer before doing so.<br></blockquote><div><br></div></span><div>+1 on the PR.</div></div></div></div></blockquote><div><br></div></div></div><div>+1 as well.<br><br>Unfortunately we can't change the default of 10, but a number of string methods, with a "bins=auto" or some such name prominently recommended in the docstring, would be very good to have.<span><font color="#888888"><br><br></font></span></div><span><font color="#888888"><div>Ralf<br></div></font></span></div></div></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>