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

Add and test a helper for dependent preemptions #244

Closed
eb8680 opened this issue Sep 4, 2023 · 0 comments · Fixed by #264
Closed

Add and test a helper for dependent preemptions #244

eb8680 opened this issue Sep 4, 2023 · 0 comments · Fixed by #264
Assignees
Labels
enhancement New feature or request module:explainable

Comments

@eb8680
Copy link
Contributor

eb8680 commented Sep 4, 2023

The design in #240 and previous iterations includes a number of new components on which the overall correctness of causation and explanation query implementations depends. To reduce the difficulty of reasoning about these implementations and make incremental progress toward landing causation and explanation queries in master, we should pull out these components and specify and test them in isolation.

One of these components is a helper function for defining dependent interventions that "undo" the effect of upstream chirho.counterfactual.ops.split operations, called undo_split in the draft design in #240

def undo_split(antecedents: Iterable[str] = [], event_dim: int = 0) -> Callable[[T], T]: ...

Dependent interventions generated from undo_split should preserve the indices of their arguments, but the values should behave as if the specified upstream split(s) never happened:

with MultiWorldCounterfactual():
  x_obs: Tensor = ...
  x_cf_1: Tensor = ...
  x_cf_2: Tensor = ...

  x_split = split(x_obs, (x_cf_1,), name="split1")
  x_split = split(x_split, (x_cf_2,), name="split2")

  undo_split2 = undo_split(antecedents=["split2"])
  x_preempted = preempt(x, (undo_split2,), True)

  assert indices_of(x_split) == indices_of(x_preempted)
  assert torch.all(gather(x, IndexSet(split2={0})) == x_preempted)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module:explainable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants