pymc.model_graph.model_to_mermaid#
- pymc.model_graph.model_to_mermaid(model=None, *, var_names=None, include_dim_lengths=True)[source]#
Produce a Mermaid diagram string from a PyMC model.
- Parameters:
- model
pm.Model The model to plot. Not required when called from inside a modelcontext.
- var_namesiterable of
variablenames, optional Subset of variables to be plotted that identify a subgraph with respect to the entire model graph
- include_dim_lengthsbool
Include the dim lengths in the plate label. Default is True.
- model
- Returns:
strMermaid diagram string representing the model graph.
Examples
Visualize a simple PyMC model
import pymc as pm with pm.Model() as model: mu = pm.Normal("mu", mu=0, sigma=1) sigma = pm.HalfNormal("sigma", sigma=1) pm.Normal("obs", mu=mu, sigma=sigma, observed=[1, 2, 3]) print(pm.model_to_mermaid(model))