Skip to content

Commit

Permalink
Explain how to make the graph from to_graphviz
Browse files Browse the repository at this point in the history
  • Loading branch information
Armavica committed Feb 29, 2024
1 parent 6c6fd13 commit ebf2f67
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pymc/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ def to_graphviz(
.. code-block:: python
import numpy as np
from pymc import HalfCauchy, Model, Normal, model_to_graphviz
from pymc import HalfCauchy, Model, Normal
J = 8
y = np.array([28, 8, -3, 7, -1, 1, 18, 12])
Expand All @@ -1890,6 +1890,14 @@ def to_graphviz(
obs = Normal("obs", theta, sigma=sigma, observed=y)
schools.to_graphviz()
Note that this code automatically plots the graph if executed in a Jupyter notebook.
If executed non-interactively, such as in a script or python console, the graph
needs to be rendered explicitly:
.. code-block:: python
# creates the file `schools.pdf`
schools.to_graphviz().render("schools")
"""
return model_to_graphviz(
model=self,
Expand Down

0 comments on commit ebf2f67

Please sign in to comment.