BasisResearch / chirho

An experimental language for causal reasoning
https://basisresearch.github.io/chirho/getting_started.html
Apache License 2.0
163 stars 10 forks source link

Counterfactual interventions on product types should only split() once #379

Open eb8680 opened 7 months ago

eb8680 commented 7 months ago

Currently, applying split to a container object like a tuple or dict within a MultiWorldCounterfactual context may result in a new split for each element of the container. The correct behavior in this case would instead be to split once and share the new index variable across all elements of the container.

eb8680 commented 4 months ago

I think this will be resolved by #528

eb8680 commented 2 months ago

@SamWitty I'm reassigning this to you since I think it corresponds to your comment on #528:

I'd like to add a tiny PR that adds an optional name kwarg to the existing dynamical systems interventions, which should change the counterfactual behavior from "one world per state variable" to "one world per static/dynamic intervention". That will also hopefully make it much easier to index into worlds produced from dynamical systems interventions. I know this PR is already intended to lead to interventions on dynamics, but figured it would be worth mentioning how it will improve the ergonomics (with a minor change) of the existing dynamical systems interventions. Thoughts?

I think this issue was resolved by #528 but you might want to try writing unit tests for the counterfactual and dynamical modules to verify that the new behavior is what you want.