Hi everyone, first post here. I have a doubt about broadcasting in scipy.
Now, I don't know if this is the expected behavior of the function, but from the documentation it doesn't seem necessary to take particular care to arrays argument in the hypergeom.cdf() function with respect to hypergeom.pmf(). Is that right or have I missed something? I'm attaching a minimal example to reproduce the error, I'm using Python2.7 through Anaconda with scipy and numpy updated to the last releases.
Thanks a lot for the support., Giovanni _______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user |
I’m not familiar with this part of the codebase, but after a bit of playing around, I think this isn’t yet implemented, maybe because it’s too hard? The relevant in scipy/stats/_distn_infrastructure.py call is:
-> 2775 m = arange(int(self.a), k+1)
self.a is the lower bound of the cdf to be computed, in this case, an array [0, 0, 0] to match the input N = self.b = [2, 4, 6]. The problem of course is that there is no general way to vectorize np.arange, because you would get a jagged array.
I hope someone with more knowledge of the library will chime in, but I think you’ll have to implement your own looping logic in the short-to-medium term…
Juan.
On 7 Oct 2017, 8:36 PM +1100, Giovanni Bonaccorsi <[hidden email]>, wrote:
_______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user |
On Sun, Oct 8, 2017 at 9:59 PM, Juan Nunez-Iglesias <[hidden email]> wrote:
I haven't seriously looked at the distribution code in a while. The reason was and, I guess, is that the support of a distribution is not vectorized, i.e. the bounds.a and .b. This means that in distributions where the support depends on a shape parameter some methods are not vectorized in that parameter. It might work in some cases but there is no generic support for it in the base classes. AFAIK .a and .b are always scalar Looks like https://github.com/scipy/scipy/issues/1320 is still open. However, I don't remember much discussion about the discrete distributions like hypergeom. Josef
_______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user |
Free forum by Nabble | Edit this page |