-
-
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
Add support for power transforms #210
base: main
Are you sure you want to change the base?
Conversation
d87ef92
to
ed2161d
Compare
Just a note that #184 originally introduced a rewrite for
Another arguments in favor of propagating domain information; we shouldn't have to make assumptions here. |
return -2 * at.log(value) | ||
from aeppl.logprob import xlogy0 | ||
|
||
power = self.transform_args_fn(*inputs) |
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.
Don't you need to use inv_power = at.reciprocal(power)
instead of power
in the expression of the jacobian?
@@ -422,8 +422,20 @@ def transform(measurable_input, *other_inputs): | |||
def measurable_reciprocal(fgraph, node): | |||
"""Rewrite a `reciprocal` node to a `MeasurableVariable`.""" | |||
|
|||
def transform(measurable_input, *other_inputs): | |||
return ReciprocalTransform(), (measurable_input,) | |||
new_node = at.power(node.inputs[0], at.as_tensor(-1)).owner |
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.
What's the advantage of using pow
to represent reciprocal
here (besides a few less lines of code)? I feel such equivalences should be handled at the Aesara-level, either by aliasing or a canonicalization pass.
This PR adds support for general power transforms and replaces #184. It uses a positive support in cases of ambiguity.
In its current form, it appears to work as a replacement for$Z = X^2$ , where $X \sim \operatorname{N}\left(0, 1\right)$ , test example fails.
at.reciprocal
, but the