We don't know if the brain really works in a Bayesian way, in an approximate Bayesian fashion, or maybe some evolutionary (more or less) optimized heuristics. Nevertheless, we know that we learn by exposing ourselves to data, examples, and exercises, although you may disagree with this statement given our record as a species on wars, economic-systems that prioritize profit and not people's wellbeing, and other atrocities. Anyway, I strongly recommend you do the following exercises:
Use the grid approach with other priors; for example, try with
prior = (grid <= 0.5).astype(int)
orprior = abs(grid – 0.5)
, or try defining your own crazy priors. Experiment with other data, like increasing the total amount of data or making it more or less even in terms of the number of heads you observe.- In the code we use to estimate keep the number N fixed and re-run the code a couple of times. Notice that the results are different because we are using random numbers, but also check that the...