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

Support ChangesOfVariables.with_logabsdet_jacobian for transformations #203

Open
oschulz opened this issue Jun 1, 2022 · 6 comments
Open

Comments

@oschulz
Copy link
Collaborator

oschulz commented Jun 1, 2022

With ChangesOfVariables.jl we now have a standard for how to express transforms with log-abs-det-jacbian values, supported by central packages like LogExpFunctions.jl, as well as TransformVariables.jl, Bijectors.jl and others.

Transforms like AffineTransform ideally use ChangesOfVariables.with_logabsdet_jacobian as their primary LADJ-handling mechanism. This could also gradually reduce dependencies on TransformVariables.jl in the code.

Pushforward (should move into MeasureBase, see JuliaMath/MeasureBase.jl#54) wouldn't need the logjac::L field anymore (with_logabsdet_jacobian now can test if an LADJ-definition exists).

@cscherrer
Copy link
Collaborator

We do need to be careful, because the transform alone isn't enough, this can depend on the base measure and the geometry of the space.

Say you have a uniform distribution on a unit 2-sphere in $\mathbb{R}^3$, and transform $(x,y,z) \mapsto (x, y, 2z)$. The logabsdet_jacobian for the ambient space is constant, 2. But this is only correct when $z=0$. And when $(x,y) = (0,0)$, the transform has no effect on the density.

@oschulz
Copy link
Collaborator Author

oschulz commented Jun 1, 2022

How do you handle this in MeasureBase.Pushforward currently?

@cscherrer
Copy link
Collaborator

I don't yet in Pushforward. In Affine, I think of it as a composition of an invertible square matrix and an orthogonal embedding. Then the embedding doesn't affect the log-density.

@cscherrer
Copy link
Collaborator

So you can work with the QR or LQ factorizations to start, and then find something equivalent that's as efficient as possible

@cscherrer
Copy link
Collaborator

I think for the more general case we should do (something equivalent to) logjac on the tangent space

@oschulz
Copy link
Collaborator Author

oschulz commented Jun 1, 2022

I think for the more general case we should do (something equivalent to) logjac on the tangent space

Hm but is there an efficient way to calculate logabsdet(J) via AD in higher dimensions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants