Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Created November 28, 2018 02:24
Show Gist options
  • Save WillKoehrsen/6fc2c6d86f9135a24144d6e7b4445add to your computer and use it in GitHub Desktop.
Save WillKoehrsen/6fc2c6d86f9135a24144d6e7b4445add to your computer and use it in GitHub Desktop.
import pymc3 as pm
import numpy as np
alphas = np.array([1, 1, 1])
c = np.array([3, 2, 1])
# Create model
with pm.Model() as model:
# Parameters of the Multinomial are from a Dirichlet
parameters = pm.Dirichlet('parameters', a=alphas, shape=3)
# Observed data is from a Multinomial distribution
observed_data = pm.Multinomial(
'observed_data', n=6, p=parameters, shape=3, observed=c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment