-
-
Save jcbozonier/7fd2045a6c3677a57f4718de7ee68080 to your computer and use it in GitHub Desktop.
Evaluating Walnut and Almond Mix
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
# The walnut/almond mix ratios we have hypothesized | |
hypotheses = [[.8, .2], | |
[.5,.5], | |
[.2,.8]] | |
# Evaluate the pdf for each hypothesis | |
# Note that we only evaluate the hypothesis | |
# for one nut. If it's 80% we know the | |
# other must be 20%. | |
pdf_score = np.array([ss.beta.pdf(hypothesis[0], 1+1, 1+5) for hypothesis in hypotheses]) | |
# Normalize the pdf values to get probabilities | |
probabilities = pdf_score/pdf_score.sum() | |
# Pair up our hypotheses and associated probabilities | |
# and print them as a list for easy viewing. | |
print(list(zip(hypotheses, probabilities))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment