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 transforming log density #13

Open
sethaxen opened this issue Jan 27, 2022 · 1 comment
Open

Support transforming log density #13

sethaxen opened this issue Jan 27, 2022 · 1 comment

Comments

@sethaxen
Copy link

ChangesOfVariables.jl implements an interface for performing a transformation and getting the corresponding log-density adjustment needed. This is implemented by a number of packages, including TransformVariables.jl and Bijectors.jl.

It would be handy if the API in this package included API functions like the following:

has_constrained_parameters(density)
has_default_unconstraining_transformation(density)
default_unconstraining_transformation(density)

If the resulting transformation is required to implement the ChangesOfVariables API, then this would allow a function to generically transform a constrained density to an unconstrained one, e.g. for sampling or optimization (an enhancement to the ChangesOfVariables API is needed to "invert" the transformation).

@oschulz
Copy link
Collaborator

oschulz commented Jan 27, 2022

I'm afraid this get's a bit specific/opinionated for what DensityInterface is supposed to do. Sometimes you need a transformation to a unconstraint space, sometimes to a constraint space (e.g. the unit hypercube), etc. - this is beyond the scope of DensityInterface. Densities also don't necessarily have constrained parameters by themselves: In a Bayesian scenario, for example, a likelihood may be well-defined over an unconstraint space, but the problem may live on a constraint space due to the choice of prior.

That doesn't mean that there shouldn't be interfaces for this: Default unconstrained transformations of distributions (and maybe measure in general in the future?) are the domain of Bijectors.jl, for example.

I'm also preparing a package VariateTransformations.jl that breaks out generic distribution/variate transformation code from BAT.jl into a standalone package. This will give implicit access to space constraints as long as initial/prior distributions are known for the parameters, via transformation to both uniform and Gaussian spaces.

In addition, the question of support/domain of functions (and their results?) is of course a very general one that extends beyond (log-)densities. I think there a several attempts to define interfaces in the ecosystem at the moment (@devmotion , do you have a list?), but no consensus yet, as far as I know.

The idea behind DensityInterface is to have something really small, lightweight and non-opinionated, to facilitate wide adoption.

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