Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created February 26, 2019 19:15
Show Gist options
  • Save ikatsov/5719151c500c5a165a964a95a7e1fcab to your computer and use it in GitHub Desktop.
Save ikatsov/5719151c500c5a165a964a95a7e1fcab to your computer and use it in GitHub Desktop.
import pymc3 as pm
d0 = [20, 28, 24, 20, 23] # observed demand samples
with pm.Model() as m:
d = pm.Gamma('theta', 1, 1) # prior distribution
pm.Poisson('d0', d, observed = d0) # likelihood
samples = pm.sample(10000) # draw samples from the posterior
seaborn.distplot(samples.get_values('theta'), fit=stats.gamma)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment