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

Default `bijector` implementation for `TransformedDistribution` #187

Closed torfjelde closed 3 years ago

torfjelde commented 3 years ago

Currently we're missing an implementation for bijector(td::TransformedDistribution) which in turn means that you can't, without a bit of work, use transformed distributions in, say, a DPPL-model.

This is stupid because it's trivial to construct this bijector: just invert td.transform, bringing us back the original domain of td.dist, and then compose this with the bijector for td.dist, which then takes us to real space.

EDIT: Btw, I have the right to call it stupid because I'm the one who didn't do it.

devmotion commented 3 years ago

Maybe add a test?

torfjelde commented 3 years ago

Yeaaah I was thinking about it, but then when I was about too I went "wait, but I want the test to the implementation..." :sweat_smile: So I don't think there's much point tbh.

devmotion commented 3 years ago

Yeah, I guess the main point would be to ensure that it exists and it returns correct values for a random input for transformed distributions with specific transforms (e.g. identity and exponentiation).

torfjelde commented 3 years ago

Added a couple :+1: