In [46]:
import scipy.stats as ss
import numpy as np
In [197]:
hypotheses = [[.8, .2], [.5,.5], [.2,.8]]
pdf_score = np.array([ss.beta.pdf(hypothesis[0], 1+1,1+5) for hypothesis in hypotheses])
probabilities = pdf_score/pdf_score.sum()
list(zip(hypotheses, probabilities))
In [199]:
hypotheses = [[.8, .2], [.5,.5], [.2,.8]]
pdf_score = np.array([ss.beta.pdf(hypothesis[0], 1+1+2,1+5+3) for hypothesis in hypotheses])
probabilities = pdf_score/pdf_score.sum()
list(zip(hypotheses, probabilities))
Out[199]:
In [123]:
pdf_array = np.array([ss.beta.pdf(0.8, 2, 6), ss.beta.pdf(0.5, 2, 6), ss.beta.pdf(0.2, 2, 6)])
pdf_array/pdf_array.sum()
Out[123]:
In [51]:
In [202]:
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)))
In [191]:
hypotheses = [[1/3,1/3,1/3], [.8, .1, .1], [.1,.8,.1],[.1,.1,.8]]
pdf_score = np.array([ss.dirichlet.pdf(hypothesis, [1+1, 1+5, 1+2]) for hypothesis in hypotheses])
probabilities = pdf_score/pdf_score.sum()
In [192]:
list(zip(hypotheses, probabilities))
Out[192]:
In [203]:
hypotheses = [[1/3,1/3,1/3], [.8, .1, .1], [.1,.8,.1],[.1,.1,.8]]
pdf_score = np.array([ss.dirichlet.pdf(hypothesis, [1+1, 1+5, 1+2]) for hypothesis in hypotheses])
probabilities = pdf_score/pdf_score.sum()
list(zip(hypotheses, probabilities))
Out[203]:
In [204]:
hypotheses = [[1/3,1/3,1/3], [.8, .1, .1], [.1,.8,.1],[.1,.1,.8]]
pdf_score = np.array([ss.dirichlet.pdf(hypothesis, [1+1+1, 1+5+4, 1+2+4]) for hypothesis in hypotheses])
probabilities = pdf_score/pdf_score.sum()
list(zip(hypotheses, probabilities))
Out[204]: