Skip to content

Instantly share code, notes, and snippets.

@jcbozonier
Last active January 30, 2017 13:43
Show Gist options
  • Save jcbozonier/6f7a9d9da898a305911eb4f2ea0e7e0a to your computer and use it in GitHub Desktop.
Save jcbozonier/6f7a9d9da898a305911eb4f2ea0e7e0a to your computer and use it in GitHub Desktop.
Moving to 3 types of nuts
# Each hypothesis in our list has a third
# element now to represent cashews.
hypotheses = [[1/3,1/3,1/3],
[.8, .1, .1],
[.1,.8,.1],
[.1,.1,.8]]
# When we evaluate our pdf for the Dirichlet
# we include a third element here to represent
# the additional nut type we observe.
pdf_score = np.array([ss.dirichlet.pdf(hypothesis, [1+1, 1+5, 1+2]) for hypothesis in hypotheses])
# Same old here
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