Hi to the list, I got an error using the pdf method on the binom distribution. Same error happens on scipy 0.8 and scipy 0.9 (respectively ubuntu distribution and pythonxy on windows). The error is the following: In [1]: from scipy.stats.distributions import binom In [2]: b = binom(20,0.8) In [3]: b.rvs() Out[3]: 17 In [4]: b.pdf(2) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) C:\Users\anto\.xy\startups\<ipython console> in <module>() C:\Python26\lib\site-packages\scipy\stats\distributions.pyc in pdf(self, x) 333 334 def pdf(self, x): #raises AttributeError in frozen discrete distribution --> 335 return self.dist.pdf(x, *self.args, **self.kwds) 336 337 def cdf(self, x): AttributeError: 'binom_gen' object has no attribute 'pdf' In [5]: Is this known problem? How can I get the binomial pdf, is there a workaround? Many thanks, Antonio
On Fri, Jul 22, 2011 at 3:31 PM, Antonio Ingargiola <tritemio@gmail.com>wrote:
Hi to the list,
I got an error using the pdf method on the binom distribution. Same error happens on scipy 0.8 and scipy 0.9 (respectively ubuntu distribution and pythonxy on windows).
The error is the following:
In [1]: from scipy.stats.distributions import binom
In [2]: b = binom(20,0.8)
In [3]: b.rvs() Out[3]: 17
In [4]: b.pdf(2) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last)
C:\Users\anto\.xy\startups\<ipython console> in <module>()
C:\Python26\lib\site-packages\scipy\stats\distributions.pyc in pdf(self, x) 333 334 def pdf(self, x): #raises AttributeError in frozen discrete distribution --> 335 return self.dist.pdf(x, *self.args, **self.kwds) 336 337 def cdf(self, x):
AttributeError: 'binom_gen' object has no attribute 'pdf'
In [5]:
Is this known problem? How can I get the binomial pdf, is there a workaround?
Since binom is a discrete distribution, you want the pmf method: In [32]: b = binom(20, 0.8) In [33]: b.pmf(2) Out[33]: 3.1876710400000011e-11 In [34]: b.pmf(18) Out[34]: 0.13690942867206304 The behavior that you observed still looks like a bug to me--why does binom even have a pdf method, if calling it just raises a cryptic exception? Warren
Many thanks, Antonio
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
2011/7/22 Warren Weckesser <warren.weckesser@enthought.com>
On Fri, Jul 22, 2011 at 3:31 PM, Antonio Ingargiola <tritemio@gmail.com>wrote:
Hi to the list,
I got an error using the pdf method on the binom distribution. Same error happens on scipy 0.8 and scipy 0.9 (respectively ubuntu distribution and pythonxy on windows).
The error is the following:
In [1]: from scipy.stats.distributions import binom
In [2]: b = binom(20,0.8)
In [3]: b.rvs() Out[3]: 17
In [4]: b.pdf(2)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last)
C:\Users\anto\.xy\startups\<ipython console> in <module>()
C:\Python26\lib\site-packages\scipy\stats\distributions.pyc in pdf(self, x) 333 334 def pdf(self, x): #raises AttributeError in frozen discrete distribution --> 335 return self.dist.pdf(x, *self.args, **self.kwds) 336 337 def cdf(self, x):
AttributeError: 'binom_gen' object has no attribute 'pdf'
In [5]:
Is this known problem? How can I get the binomial pdf, is there a workaround?
Since binom is a discrete distribution, you want the pmf method:
In [32]: b = binom(20, 0.8)
In [33]: b.pmf(2) Out[33]: 3.1876710400000011e-11
In [34]: b.pmf(18) Out[34]: 0.13690942867206304
The behavior that you observed still looks like a bug to me--why does binom even have a pdf method, if calling it just raises a cryptic exception?
Warren, Thanks for the clarification. And BTW yes I think that this behaviour is quite boguous. Should I fill a bug report? Antonio
On Fri, Jul 22, 2011 at 6:30 PM, Antonio Ingargiola <tritemio@gmail.com>wrote:
2011/7/22 Warren Weckesser <warren.weckesser@enthought.com>
On Fri, Jul 22, 2011 at 3:31 PM, Antonio Ingargiola <tritemio@gmail.com>wrote:
Hi to the list,
I got an error using the pdf method on the binom distribution. Same error happens on scipy 0.8 and scipy 0.9 (respectively ubuntu distribution and pythonxy on windows).
The error is the following:
In [1]: from scipy.stats.distributions import binom
In [2]: b = binom(20,0.8)
In [3]: b.rvs() Out[3]: 17
In [4]: b.pdf(2)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last)
C:\Users\anto\.xy\startups\<ipython console> in <module>()
C:\Python26\lib\site-packages\scipy\stats\distributions.pyc in pdf(self, x) 333 334 def pdf(self, x): #raises AttributeError in frozen discrete distribution --> 335 return self.dist.pdf(x, *self.args, **self.kwds) 336 337 def cdf(self, x):
AttributeError: 'binom_gen' object has no attribute 'pdf'
In [5]:
Is this known problem? How can I get the binomial pdf, is there a workaround?
Since binom is a discrete distribution, you want the pmf method:
In [32]: b = binom(20, 0.8)
In [33]: b.pmf(2) Out[33]: 3.1876710400000011e-11
In [34]: b.pmf(18) Out[34]: 0.13690942867206304
The behavior that you observed still looks like a bug to me--why does binom even have a pdf method, if calling it just raises a cryptic exception?
Warren, Thanks for the clarification. And BTW yes I think that this behaviour is quite boguous. Should I fill a bug report?
Good idea--please do. Warren
Antonio
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
Hi, I created a ticket for this problem: http://projects.scipy.org/scipy/ticket/1487 Hope that somebody will fix it. Regards, Antonio 2011/7/22 Warren Weckesser <warren.weckesser@enthought.com>
On Fri, Jul 22, 2011 at 6:30 PM, Antonio Ingargiola <tritemio@gmail.com>wrote:
2011/7/22 Warren Weckesser <warren.weckesser@enthought.com>
On Fri, Jul 22, 2011 at 3:31 PM, Antonio Ingargiola <tritemio@gmail.com>wrote:
Hi to the list,
I got an error using the pdf method on the binom distribution. Same error happens on scipy 0.8 and scipy 0.9 (respectively ubuntu distribution and pythonxy on windows).
The error is the following:
In [1]: from scipy.stats.distributions import binom
In [2]: b = binom(20,0.8)
In [3]: b.rvs() Out[3]: 17
In [4]: b.pdf(2)
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last)
C:\Users\anto\.xy\startups\<ipython console> in <module>()
C:\Python26\lib\site-packages\scipy\stats\distributions.pyc in pdf(self, x) 333 334 def pdf(self, x): #raises AttributeError in frozen discrete distribution --> 335 return self.dist.pdf(x, *self.args, **self.kwds) 336 337 def cdf(self, x):
AttributeError: 'binom_gen' object has no attribute 'pdf'
In [5]:
Is this known problem? How can I get the binomial pdf, is there a workaround?
Since binom is a discrete distribution, you want the pmf method:
In [32]: b = binom(20, 0.8)
In [33]: b.pmf(2) Out[33]: 3.1876710400000011e-11
In [34]: b.pmf(18) Out[34]: 0.13690942867206304
The behavior that you observed still looks like a bug to me--why does binom even have a pdf method, if calling it just raises a cryptic exception?
Warren, Thanks for the clarification. And BTW yes I think that this behaviour is quite boguous. Should I fill a bug report?
Good idea--please do.
Warren
Antonio
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
participants (2)
-
Antonio Ingargiola
-
Warren Weckesser