#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pymc3 as pm # Simulate data from Gaussian with mean=2 and SD=5 and try to recover these parameters with PyMC3. # In[2]: x = np.random.normal(2, 5, size=1000) # In[3]: with pm.Model() as model: mu = pm.Normal('mu', 0, sd=1e4) sigma = pm.HalfCauchy('sigma', 25) likelihood = pm.Normal('likelihood', mu, sd=sigma, observed=x) # In[5]: with model: tr = pm.sample(1000) # In[6]: pm.summary(tr)