Repository navigation
Support scan for Trace_ELBO - #1693
Merged
Merged
Conversation
Member
|
Nice support, @deoxyribose! Could you add tests for this change? |
added 2 commits
December 6, 2023 13:12
Contributor
Author
|
I've added a test that does SVI with an AutoNormal guide, and checks that results are relatively accurate. I've kept model and data size to a minimum, the test takes around 3-4 seconds on my machine. There already was a test combining scan, SVI and AutoNormal (test_subsample_guide in test/infer/test_autoguide.py), but it doesn't run inference and checks results, so the current version of scan passes it. |
fehiepsi
approved these changes
Dec 15, 2023
fehiepsi
left a comment
Member
There was a problem hiding this comment.
Looks great! Thanks, @deoxyribose !
| site["value"] = site["value"][i] | ||
| return site | ||
|
|
||
| return {k: get_ith_value(v.copy()) for k, v in replay_trace.items()} |
Member
There was a problem hiding this comment.
nit: it is better to do the copy inside git_ith_value
OlaRonning
added a commit
to aleatory-science/numpyro
that referenced
this pull request
May 6, 2024
* scan replay handling * fix off by one error * cleaned a bit * lint * use substack * handle custom guides * handle empty value shape * a * test * move copy inside get_ith_value --------- Co-authored-by: frans <[email protected]> Co-authored-by: OlaRonning <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #1685
Reuse the
substitute_stackto store the replay trace, and replay the sites in the scan'ed function one iteration at a time.