-
Notifications
You must be signed in to change notification settings - Fork 20
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
Support conversion of Transforms and TransformedDistributions to and from Funsors #365
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
9b6a3bc
transformed distribution conversion and sampling
eb8680 6b3371a
most distribution tests passing?
eb8680 fcb70ea
nit
eb8680 78747a5
dont add lebesgue by default
eb8680 a469cd7
add lebesgue in conversion
eb8680 be80ef0
transform?
eb8680 2016ba1
add transform conversions
eb8680 7880e40
Merge branch 'master' into lebesgue-2
eb8680 2a4d548
Merge branch 'master' into lebesgue-2
eb8680 2f0b0ea
add some tests
eb8680 08949cf
add composition to transform conversion
eb8680 8d5a5ad
nit
eb8680 05cd1a2
remove sigmoid transform conversion patterns
eb8680 a3f8050
fix transform composition order
eb8680 fbc91b7
nit
eb8680 7400b41
Merge branch 'master' into lebesgue-2
eb8680 77aca44
Merge branch 'master' into lebesgue-2
eb8680 c14f3ac
fix merge
eb8680 67777fa
increase tolerance in flaky binomial test?
eb8680 cd13b30
fix errors in transformed sampling
eb8680 6765bd7
support sampling from transformed distribution in Contraction
eb8680 c89fa88
Add atanh and tanh ops for TanhTransform
eb8680 e10b962
fix error in lognormal test
eb8680 d6efe96
fix tests
eb8680 18af534
sigmoid
eb8680 1c42e8e
Merge branch 'tanh-op' into lebesgue-2
eb8680 22b2115
register tanh and sigmoid for conversion
eb8680 f78b0ab
Merge branch 'master' into lebesgue-2
eb8680 e18f5ce
Merge branch 'master' into lebesgue-2
eb8680 f24a599
fix jax tests
eb8680 974b21b
Merge branch 'master' into lebesgue-2
eb8680 2d93270
simplify unscaled_sample
eb8680 092141c
Re-xfail lognormal sampler test
eb8680 ddb6d86
Merge branch 'master' into lebesgue-2
eb8680 bcf52cc
organization nit
eb8680 0d46e5d
add some transformeddist test cases
eb8680 6e33c93
Merge branch 'master' into lebesgue-2
eb8680 0966eb0
fix conversion by avoiding double inversion
eb8680 6c2cc27
use normalize
eb8680 b59a0d8
add xfail option to DistTestCase and add an xfailing Independent(Tran…
eb8680 8d9d965
add jax xfails
eb8680 bdde5b4
move Lebesgue to a separate branch
eb8680 8aab02d
lint
eb8680 0df073f
address comments
eb8680 b8f553f
isdisjoint
eb8680 18c87f3
Merge branch 'master' into lebesgue-2
eb8680 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
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
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
Oops, something went wrong.
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.
This looks weird. Can you explain what's going on? When is
value_name != "value"
? The assertion inself.__init__()
suggestsvalue_name == "value"
IIUC.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.
value_name
can potentially be anything, sinceself.value
is a lazy expression. This logic is meant to solve the problem of identifying the value name whenself.value
is not aVariable
or even has more than one input (which happens when constructing the Funsor version of aTransformedDistribution
).The simplest nontrivial example of the latter case would be an affine or power transform where the parameters are
funsor.Tensor
s with nontrivial.inputs
, although these are not handled in this PR sincefunsor.delta.solve
does not yet support inverting such expressions.The main use for
value_name
in this PR is inDistribution.unscaled_sample
, which needs to knowvalue_name
to construct a sampleDelta
with the correct.inputs
.