Professional Documents
Culture Documents
2. Exponential distribution with probability density function f (x|λ) = λe−λx for λ > 0
given observations xi ≥ 0.
p(θ|D) = Dir(θ|α + x)
Hint: You do not have to calculate the normalization constant, i.e., prove that the
posterior is proportional to a Dirichlet distribution with parameter α + x.
1. Calculate p(θ1 > θ2 |D1 , D2 ) using quadrature, e.g., by using the function dblquad
from scipy.integrate.
2. Calculate p(θ1 > θ2 |D1 , D2 ) using Monte Carlo integration1 . You can generate Beta
distributed samples with the function scipy.stats.beta.rvs(a,b,size).
1
https://en.wikipedia.org/wiki/Monte_Carlo_integration