8

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?

merv
  • 67,214
  • 13
  • 180
  • 245
user8270077
  • 4,621
  • 17
  • 75
  • 140

1 Answers1

11

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)

enter image description here

merv
  • 67,214
  • 13
  • 180
  • 245