Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow exclusion of variables and their descendants with ~ in var_names #5794

Open
larryshamalama opened this issue May 23, 2022 · 0 comments

Comments

@larryshamalama
Copy link
Member

larryshamalama commented May 23, 2022

Following the merge of #5527, it would be good to allow users to selectively exclude variables using ~ in var_names. For instance, given a full model:

with pm.Model() as pmodel2:
    a = pm.Normal("a")
    b = pm.Normal("b")
    c = pm.Normal("c", a * b)
    intermediate = pm.Deterministic("intermediate", a + b)
    pred = pm.Deterministic("pred", intermediate * 3)

    obs = pm.ConstantData("obs", 1.75)

    L = pm.Normal("L", mu=1 + 0.5 * pred, observed=obs)

display(pm.model_to_graphviz(pmodel2)) # Fig. 1
display(pm.model_to_graphviz(pmodel2, var_names=["~pred"])) # Fig. 2

which would yield the following images where, in Fig. 2, pred, L and obs are all removed.

Fig. 1 Fig. 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant