I am using the following code to create a simple Model with PyMC3:
import pymc3 as pm
import theano.tensor as tt
with pm.Model() as model:
p = pm.Uniform("freq_cheating", 0, 1)
p_skewed = pm.Deterministic("p_skewed", 0.5*p + 0.25)
yes_responses = pm.Binomial("number_cheaters", 100, p_skewed, observed= 50)
step = pm.Metropolis()
trace = pm.sample(25000, step=step)
burned_trace50 = trace[2500:]
Is it possible to plot this model as a DAG?
Added in version 3.5 is the model_to_graphviz
method, which does exactly that. For your example above, you'd use
pm.model_to_graphviz(model)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With