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

438 add various interventions to interfacesipynb #493

Merged
merged 20 commits into from
Mar 11, 2024

Conversation

sabinala
Copy link
Contributor

Closes #438

@sabinala sabinala added the WIP PR submitter still making changes, not ready for review label Feb 21, 2024
@sabinala sabinala self-assigned this Feb 21, 2024
@sabinala sabinala linked an issue Feb 21, 2024 that may be closed by this pull request
4 tasks
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@sabinala sabinala added awaiting review PR submitter awaiting code review from reviewer and removed WIP PR submitter still making changes, not ready for review labels Feb 26, 2024
@SamWitty
Copy link
Contributor

SamWitty commented Mar 7, 2024

@sabinala , could you resolve conflicts and then tag me when this is ready for review again? Thanks!

@sabinala
Copy link
Contributor Author

sabinala commented Mar 7, 2024

@SamWitty I resolved the branch conflicts, and then went to run the notebook again and now I'm getting an error when trying to sample with interventions. I'm confused because I thought this came up and was resolved, but please see: #524

@SamWitty
Copy link
Contributor

SamWitty commented Mar 7, 2024

I get an error with this notebook at the dynamic parameter intervention (which explains why the notebook CI test fails), but it is successfully running the static interventions. See my comment about a fresh environment in #524.

@SamWitty
Copy link
Contributor

SamWitty commented Mar 7, 2024

@sabinala , I fixed the notebook up to optimize. I believe in your merge you erased changes to the API that @anirban-chaudhuri had made. Once you resolve your PyCIEMSS and ChiRho version errors you should be able to pick up from there.

@sabinala
Copy link
Contributor Author

sabinala commented Mar 7, 2024

@SamWitty Thanks, trying that now

@SamWitty
Copy link
Contributor

SamWitty commented Mar 7, 2024

Adding @anirban-chaudhuri as a reviewer to confirm that this did not revert previous changes to optimize. Once Anirban approves (after the remaining issue is fixed) we can merge.

@sabinala
Copy link
Contributor Author

sabinala commented Mar 7, 2024

@SamWitty starting with a fresh environment did fix the errors I was getting before. Are you no longer getting an error for dynamic_parameter_intervention? When I run it with make_var_threshold defined as:

def make_var_threshold(var: str, threshold: torch.Tensor):
    def var_threshold(time, state):
        return state[var] - threshold
    return var_threshold

I get a KeyError:

File ~/anaconda3/lib/python3.10/site-packages/pyro/infer/predictive.py:55, in <dictcomp>(.0)
     52         collected.append(trace)
     53     else:
     54         collected.append(
---> 55             {site: trace.nodes[site]["value"] for site in return_site_shapes}
     56         )
     58 if return_trace:
     59     return collected

KeyError: 'parameter_intervention_value_p_cbeta_0'

Copy link
Contributor

@anirban-chaudhuri anirban-chaudhuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last part with optimize is the old version. We need to copy over the newer notebook implementation for optimize from interfaces.ipynb from main.

@sabinala
Copy link
Contributor Author

sabinala commented Mar 8, 2024

@SamWitty @anirban-chaudhuri This notebook is ready to go and includes the new optimize interface implementations

@sabinala
Copy link
Contributor Author

sabinala commented Mar 8, 2024

@SamWitty @anirban-chaudhuri This notebook is ready to go and includes the new optimize interface implementations

Nevermind...cannot get the notebook test to pass :(

@SamWitty
Copy link
Contributor

@sabinala , unfortunately the CI does not return very informative error messages for the notebook tests. When I run the test_notebooks.sh script locally I get an error ERROR docs/source/interfaces.ipynb::Cell 0 - jupyter_client.kernelspec.NoSuchKernel: No such kernel named pyciemss which is a bit more informative. It looks like you made some accidental changes to the kernel from python3 to pyciemss, which doesn't exist in the CI build.

Copy link
Contributor

@SamWitty SamWitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the CI issues are now addressed.

@SamWitty
Copy link
Contributor

@sabinala , this issue looks slightly more nuanced. I'll figure it out. Please hold off on making more commits.

@SamWitty SamWitty merged commit 68720c0 into main Mar 11, 2024
4 checks passed
@SamWitty SamWitty deleted the 438-add-various-interventions-to-interfacesipynb branch March 11, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review PR submitter awaiting code review from reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add various interventions to interfaces.ipynb
3 participants