Skip to content

Instantly share code, notes, and snippets.

@kgori
Last active January 23, 2017 18:47
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 kgori/5ad0fa2859811122c344088de81f9b0d to your computer and use it in GitHub Desktop.
Save kgori/5ad0fa2859811122c344088de81f9b0d to your computer and use it in GitHub Desktop.
PYMC3 model code to do signature fitting using NUTS
"""
PYMC3 model code to do signature fitting using NUTS
"""
import pymc3
from theano import tensor
mytest = pymc3.Model()
counts = data
with mytest:
mixing_proportions = pymc3.Dirichlet('mixing_proportions', a = np.ones(30), shape = 30)
likelihood = pymc3.Multinomial('likelihood',
n = counts.sum(),
p = tensor.dot(signatures.T, mixing_proportions),
observed = counts)
with mytest:
trace = pymc3.sample(10000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment