Exercises
Here is a series of exercises. Answers to all the exercises are given in the Jupyter Answers_to_Exercises_Chap5.ipynb
notebook in the GitHub repository:
- For the MAP estimation code example in the text, we used the
scipy.optimize.minimize
function to do the optimization of the log-posterior. Theminimize
function has the option for the user to supply a callable function that calculates the gradient of the objective function with respect to the objective function parameters. Work out on paper the gradient of the log-posterior and implement a function that returns the gradient of the log-posterior. Re-run the MAP estimation process usingscipy.optimize.minimize
, but when you pass in your log-posterior gradient function, you’ll need to look at the online documentation for thescipy.optimize.minimize
function to see how your callable gradient function should be passed in. - The
Data/coffee_or_tea.csv
file in the GitHub repository contains two columns of data,...