Skip to content

Instantly share code, notes, and snippets.

@breakbee
Created August 3, 2014 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breakbee/24d1a8594338bc99d54f to your computer and use it in GitHub Desktop.
Save breakbee/24d1a8594338bc99d54f to your computer and use it in GitHub Desktop.
import pymc as pm
import numpy as np
x_sample = np.random.normal(loc=1.0, scale=1.0, size=1000)
with pm.Model() as model:
mu = pm.Normal('mu', mu=0., sd=0.1)
x = pm.Normal('x', mu=mu, sd=1., observed=x_sample)
with model:
start = pm.find_MAP()
step = pm.NUTS()
trace = pm.sample(10000, step, start)
pm.traceplot(trace).savefig("result1.jpg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment