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

Fix render_model for intervened variables #58

Open
SamWitty opened this issue Oct 27, 2022 · 1 comment
Open

Fix render_model for intervened variables #58

SamWitty opened this issue Oct 27, 2022 · 1 comment

Comments

@SamWitty
Copy link
Collaborator

Currently, applying pyro.render_model to a model after an intervention removes edges out of the intervened variable, rather than into the intervened variable.

Pre Intervention Example
pre_intervention_render

Post Intervention Example
post_intervention_render

@SamWitty SamWitty added bug Something isn't working examples misc-release labels Oct 27, 2022
@SamWitty SamWitty added this to the Initial public release milestone Oct 27, 2022
@eb8680
Copy link
Contributor

eb8680 commented Nov 2, 2022

This is (currently) expected behavior from Pyro's point of view - intervene and do have a SWIG-like default semantics, in which intervened variables like training disappear because they can be marginalized away if not observed, not because of the semantics of intervention itself.

To get the behavior proposed here (still a worthwhile goal since many people will have the same question), we could do the following:

  1. use an effect handler to change the meaning of do and intervene so that the training random variable is removed entirely (see e.g. this example Interventional handler in the counterfactual docstring)
  2. enable rendering of pyro.deterministic sites in Pyro - see Investigate and possibly fix upstream Pyro issues with rendering deterministic dependencies #41.

@eb8680 eb8680 added enhancement New feature or request upstream and removed bug Something isn't working misc-release examples labels Nov 2, 2022
@eb8680 eb8680 removed this from the Initial public release milestone Mar 15, 2023
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

2 participants