Histgrom density estimation (density kwarg) with out of range values

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Histgrom density estimation (density kwarg) with out of range values

Sebastian Berg
Hi all,

unfortunately it was noticed in Issue 13604 [0] that when histogram is
given used with a specified range and the `density=True` keyword
argument out of bound values are simply discarded [1].

Discarding out of bound values makes sense when the density/normed
option is not used, since in that case event counts are reported.
However, when out of bound values exist, the probability density should
arguably not sum up to 1 anymore.

We seem to have three ways possible to continue here:

1. Call it an outright bug and fix it.
2. Add a FutureWarning, and change it later (unfortunately noisy)
3. Add a new kwarg to control what happens and a FutureWarning which
   can be silenced using the new kwarg.

(No change will ever happen if `range` or manual bin edges were not

If all agree that there is no reasonable use case for the current
implementation, it would be tempting to simply change it, or use a
FutureWarning (unfortunately forcing users to manually calculate the
density). If there is any half-decent use case, the kwarg may be the
nicer option.

Personally, if no one finds has a use case, I am slightly tending
towards the "bug fix" option right now.

All the Best,


[0] https://github.com/numpy/numpy/issues/13604
[1] As mentioned in the documentation.

NumPy-Discussion mailing list
[hidden email]

signature.asc (849 bytes) Download Attachment