User Tools

Site Tools


cs401r_w2016:lab10

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cs401r_w2016:lab10 [2016/03/17 20:39]
admin
cs401r_w2016:lab10 [2021/06/30 23:42] (current)
Line 24: Line 24:
 {{ :​cs401r_w2016:​lab9_t3.png?​direct&​400 |}} {{ :​cs401r_w2016:​lab9_t3.png?​direct&​400 |}}
  
-Your notebook should produce similar plots for the HMC algorithm, although you only need to produce two plots (one histogram, and one state evolution plot, instead of three of each).+Your notebook should produce similar plots for the HMC algorithm, although you only need to produce two plots (one histogram, and one state evolution plot, instead of three of each). So to clarify, your notebook should have 6 plots for part one (three histograms, three evolution plots) and two plots for part two (one histogram, one evolution plot).
  
 Your notebook should also include a small writeup of your results, as described below. Your notebook should also include a small writeup of your results, as described below.
Line 46: Line 46:
 <code python> <code python>
 import numpy as np import numpy as np
-def p( x, t=1.0 ): +def p( x, temperature=1.0 ): 
-    return np.exp( -10*t*((x-2)**2) ) + 0.3*np.exp( -0.5*10*t*((x+1)**2) )+    return np.exp( -10*temperature*((x-2)**2) ) + 0.3*np.exp( -0.5*10*temperature*((x+1)**2) )
 </​code>​ </​code>​
  
Line 62: Line 62:
 **Part 2: Hamiltonian MCMC** **Part 2: Hamiltonian MCMC**
  
-For this part, you will code the Hamiltonian MCMC algorithm, as discussed in class. ​ To do this, you will need to compute the gradient of the density function with respect to the state. ​ An easy easy way to do this is to use the [[https://​github.com/​HIPS/​autograd|autograd]] package:+For this part, you will code the Hamiltonian MCMC algorithm, as discussed in class. You will run three independent chains and report them in the same graphs.  To do this, you will need to compute the gradient of the density function with respect to the state. ​ An easy easy way to do this is to use the [[https://​github.com/​HIPS/​autograd|autograd]] package:
 <code python> <code python>
 from autograd import grad from autograd import grad
cs401r_w2016/lab10.1458247197.txt.gz · Last modified: 2021/06/30 23:40 (external edit)