Last active
January 30, 2017 13:43
-
-
Save jcbozonier/6f7a9d9da898a305911eb4f2ea0e7e0a to your computer and use it in GitHub Desktop.
Moving to 3 types of nuts
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
# 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