Open oschulz opened 2 years ago
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.
How do you handle this in MeasureBase.Pushforward
currently?
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.
So you can work with the QR or LQ factorizations to start, and then find something equivalent that's as efficient as possible
I think for the more general case we should do (something equivalent to) logjac on the tangent space
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?
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 useChangesOfVariables.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 cscherrer/MeasureBase.jl#54) wouldn't need thelogjac::L
field anymore (with_logabsdet_jacobian
now can test if an LADJ-definition exists).