-
-
Notifications
You must be signed in to change notification settings - Fork 984
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
New Trace_ELBO
that generalizes Trace_ELBO
, TraceEnum_ELBO
, and TraceGraph_ELBO
#2893
Draft
ordabayevy
wants to merge
62
commits into
pyro-ppl:dev
Choose a base branch
from
ordabayevy:fix-funsor-traceelbo
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
b00948c
trace_elbo
da2f887
lint
f6c95e4
Merge branch 'dev' of https://github.com/pyro-ppl/pyro into fix-funso…
3ec076d
test_gradient
a22ff4e
copy traceenum_elbo and add test model with poisson dist
d551fa2
lint
b68bb3f
use constant funsor
bfb13bf
working version
ca1a1fe
pass second test
6d6a9ed
clean up trace_elbo
0f23b42
add another test
91384ed
lazy eval
c18a8bd
Merge branch 'dev' of https://github.com/pyro-ppl/pyro into fix-funso…
34d9a3c
Merge branch 'dev' of https://github.com/pyro-ppl/pyro into fix-funso…
b0182c0
vectorize particles; update tests
dc31767
minor fixes; pin to funsor@normalize-logaddexp
5c0fe75
update docs/requirements
2b15fe1
combine Trace_ELBO and TraceEnum_ELBO
351090b
eager evaluation
7d029c7
rm file
1bb7380
lazy
42ad4fa
remove memoize
5b6afdb
merge TraceEnum_ELBO
33628aa
skip test
18a973b
fixes
2c3ead3
convert Tensor to Categorical
5fb1522
restore docs/requirements.txt
f907f93
pin funsor in docs/requirements
902e445
Merge branch 'dev' of https://github.com/pyro-ppl/pyro into fix-funso…
0042f85
use funsor.optimizer.apply_optimizer; higher precision in the test
ee5a5ad
pin funsor to the latest commit
e4c6760
optimize logzq
aba300a
optimize logzq
d823153
restore TraceEnum_ELBO
c06e9e4
revert hmm changes
eee297d
_tensor_to_categorical helper function
d748efa
lazy to_funsor
a1970d6
reduce over particle_var
4c1ee9e
address comment in tests
5df30c8
import pyroapi
46ff6f4
compute expected grads using dice factors
d7ee7ee
add test with guide enumeration
49553c3
add two more tests
835f815
pin funsor
760eeb0
lint
ab3831c
remove breakpoint
0b46f3a
Merge branch 'dev' of https://github.com/pyro-ppl/pyro into fix-funso…
b6ff8e0
Approximate(ops.sample, ...) based approach
b5bece7
Importance funsor based approach
d6e246e
fixes
6582d7d
Merge branch 'dev' into fix-funsor-traceelbo
714fd62
fix funsor model enumeration
2d2210e
Merge branch 'fix-model-enumeration-funsor' into fix-funsor-traceelbo
29bad7a
use Sampled funsor
9144be1
fixes
e4c8a47
git fixes
c147ad9
Merge branch 'dev' into fix-funsor-traceelbo
703a2fa
use Provenance funsor
3137b1b
clean up
88713f6
fixes
99a0647
Merge branch 'dev' into fix-funsor-traceelbo
14131ad
use provenance
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this missing Dice factors included in
log_measures
? IIRC that was the reason for usingIntegrate
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied the test from #2894 which has a simple model/guide pair. When running that model (
Elbo=Trace_ELBO, backend=contrib.funsor, reparam-False
) bothguide_terms["log_measures"]
andmodel_terms["log_measures"]
are empty. I can't find Dice factors anywhere inmodel_terms
orguide_terms
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess they're not included because
Funsor.sample
isn't used in the evaluation ofTrace_ELBO
. I don't thinkcontrib.funsor.infer.Trace_ELBO
is tested extensively outside thepyro-api
tests intests/contrib/funsor/test_pyroapi_funsor.py
, which is why this wasn't noticed before.A more general Funsor-based implementation of
Trace_ELBO
is certainly possible and would look very similar to the guide-side enumeration handling logic inTraceEnum_ELBO
. We might even be able to write a custom "enumeration" strategy that just calledFunsor.sample
and reuseTraceEnum_ELBO
as theTrace_ELBO
implementation.I believe a completely general version might require variable elimination logic beyond what's currently in
funsor.sum_product
handling cases where the guide had plate structure incompatible with the restrictions there, although I can't immediately think of existing tests or examples where that would be the case.