Skip to content

Instantly share code, notes, and snippets.

@jcbozonier
Forked from anonymous/py.py
Created January 30, 2017 13:38
Show Gist options
  • Save jcbozonier/a3d8b1564bdf738e69626d22f8e9ea21 to your computer and use it in GitHub Desktop.
Save jcbozonier/a3d8b1564bdf738e69626d22f8e9ea21 to your computer and use it in GitHub Desktop.
Switching from Beta to Dirichlet
hypotheses = [[.8, .2],
[.5,.5],
[.2,.8]]
# Notice how we swapped out the Beta for
# a Dirichlet. The only difference is we
# now pass a list of counts to the pdf
# function. We'll get to why in a bit.
pdf_score = np.array([ss.dirichlet.pdf(hypothesis, [1+1+2, 1+5+3]) for hypothesis in hypotheses])
probabilities = pdf_score/pdf_score.sum()
print(list(zip(hypotheses, probabilities)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment