Homepage › Solution manuals › Kevin P. Murphy › Machine Learning: a Probabilistic Perspective › Exercise 3.16 - Setting the beta hyper-parameters II
Exercise 3.16 - Setting the beta hyper-parameters II
Answers
import math m=0.15 l=0.05 u=0.3 MC=1000 delta=(u-l)/MC def pm(a2): a1=a2*m/(1-m) pivot=l mass=0 B=math.gamma(a1)*math.gamma(a2)/math.gamma(a1+a2) for i in range(MC): pivot=pivot+delta mass=mass+pivot**(a1-1)*(1-pivot)**(a2-1) mass=mass*delta/B return mass
The result of which is better demonstrated through the graph:

So the optimal choice is . This is tantamount to adopt 32 extra samples.
2021-03-24 13:42