Created
August 22, 2010 20:34
-
-
Save alextp/544248 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def collapsed_likelihood(tprior, gmean, gvar, tcount): | |
p0 = sum(np.log(gamma_pdf(tp, gmean, gvar)) for tp in tprior) | |
p0 += tcount.shape[0]*(gammaln(sum(tprior))-sum(gammaln(tp) for tp in tprior)) | |
for d in xrange(tcount.shape[0]): | |
for i,t in enumerate(tcount[d]): | |
p0 += gammaln(t + tprior[i]) | |
p0 -= gammaln(sum(tcount[d]) + sum(tprior)) | |
return p0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment