TuringLang / Bijectors.jl

Implementation of normalising flows and constrained random variable transformations
https://turinglang.org/Bijectors.jl/
MIT License
200 stars 33 forks source link

Run interface tests, update badges, and fix planar layer #157

Closed devmotion closed 3 years ago

devmotion commented 3 years ago

I had a look at the planer layer and found a bug in the implementation of the inverse.

However, one can also rewrite the forward pass in a simpler and, it seems, numerically more stable way. To keep the PR small, I don't include these possible changes here and just try to fix the test errors.

devmotion commented 3 years ago

The bracket thing is my own derivation to speed up the root finding algorithm (I haven't seen a discussion of it anywhere else), the bugfix (removal of norm(w, 2)) can be checked by looking at eq. (22) in the original paper https://arxiv.org/pdf/1505.05770.pdf and plugging in the parameterization of z|| with alpha below the equation (we solve eq. (22) for z = z| + z||).

devmotion commented 3 years ago

There are multiple references to the original paper in the source code but maybe not to eq. (22) explicitly at this line.