[Scipy-tickets] [SciPy] #1436: stats.poisson.logpmf(k, loc) numeric overflow

SciPy Trac scipy-tickets@scipy....
Thu May 5 11:52:22 CDT 2011

#1436: stats.poisson.logpmf(k, loc) numeric overflow
 Reporter:  kairit       |       Owner:  somebody    
     Type:  enhancement  |      Status:  needs_review
 Priority:  normal       |   Milestone:              
Component:  scipy.stats  |     Version:  0.9.0       
 Keywords:               |  
Changes (by josefpktd):

  * status:  new => needs_review


 Thanks for reporting this.

 It's a trivial fix to add an explicit _logpmf calculation to poisson
 (instead of using generic) since pmf first calculates logpmf and then
 takes exp

 >>> from scipy.special import gammaln
 >>> k, mu = 1500, 200
 >>> k*np.log(mu)-gammaln(k+1) - mu

 fix should be something like


     def _logpmf(self, k, mu):
         Pk = k*log(mu)- gamln(k+1) - mu
         return Pk

     def _pmf(self, k, mu):
         return exp(self._logpmf(k, mu))


 I can change this next week.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1436#comment:2>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list