You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
am, bm=Poisson.posterior_hypers(N+1, sum_x+x, a, b)
ZN=Poisson.calc_log_Z(an, bn)
ZM=Poisson.calc_log_Z(am, bm)
returnZM-ZN-gammaln(x+1)
@staticmethod
defcalc_logpdf_marginal(N, sum_x, sum_log_fact_x, a, b):
an, bn=Poisson.posterior_hypers(N, sum_x, a, b)
Z0=Poisson.calc_log_Z(a, b)
ZN=Poisson.calc_log_Z(an, bn)
returnZN-Z0-sum_log_fact_x
@staticmethod
defposterior_hypers(N, sum_x, a, b):
an=a+sum_x
bn=b+N
returnan, bn
@staticmethod
defcalc_log_Z(a, b):
Z=gammaln(a) -a*log(b)
returnZ
The posterior predictive distribution should be a negative binomial with n = a' and p = 1 / (1 + b'), or possibly p = 1 - 1/(1+b'), depending on the parameterization. From a cursory test the values returned by Poisson.calc_predictive_logp do not correspond to the negative binomial probabilities from scipy.stats.nbinom.
The text was updated successfully, but these errors were encountered:
Specifically the following lines
cgpm/src/primitives/poisson.py
Lines 146 to 170 in 46e1d8d
The posterior predictive distribution should be a negative binomial with n = a' and p = 1 / (1 + b'), or possibly p = 1 - 1/(1+b'), depending on the parameterization. From a cursory test the values returned by Poisson.calc_predictive_logp do not correspond to the negative binomial probabilities from scipy.stats.nbinom.
The text was updated successfully, but these errors were encountered: