Skip to content

Instantly share code, notes, and snippets.

Created January 30, 2017 13:30
Show Gist options
  • Save anonymous/3cb02e0233f0ba3282e9d7623f216316 to your computer and use it in GitHub Desktop.
Save anonymous/3cb02e0233f0ba3282e9d7623f216316 to your computer and use it in GitHub Desktop.
Evaluating Walnut and Almond Mix
# 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