Question: In Python generate 4096 flips of the coin using the binomial function of the random module in numpy: import numpy.random flips = numpy.random.binomial(1, bias,
In Python generate 4096 "flips" of the coin using the binomial function of the random module in numpy: import numpy.random flips = numpy.random.binomial(1, bias, 4096) Where bias is the value of the bias weighting you chose. In python write a function for the likelihood function for the flips. You'll want to be able to compute the function for a set of bias weightings, a number of flips, and a number of heads in that number of flips. You must: 1. Compute the various probabilities as (natural) logarithms. 2. Normalize the binomial function 3. Use the approximation: In(N!) ~ N In N - N + ln(2+N)/2. 4. Sample the bias weighting parameter H rather finely: AH = 0.001 works well. (In Python use numpy.arange(0.001, 1.0, 0.001) Choose an adequate prior and write a function for it, the prior on H is given by: H (0 -1/2H+3/8 (0.25 1/2H - 1/8 (0.5 -H+1
Step by Step Solution
3.45 Rating (161 Votes )
There are 3 Steps involved in it
stepbystep guide to implement the Bayesian inference for estimating the bi... View full answer
Get step-by-step solutions from verified subject matter experts
