Comments (4)
FWIW, there's another ℝⁿ⁻¹ → ℝⁿ implementation in HMCUtilities.jl.
from bijectors.jl.
As you've correctly pointed out this transformation is really a bijection between b: Kⁿ⁻¹→ℝⁿ⁻¹ where Kⁿ⁻¹ is a (n-1)-dim unit-simplex but both Kⁿ⁻¹ and ℝⁿ⁻¹ are considered as subsets of ℝⁿ (since a sample from Dirichlet
is represented as a n-dim vector). This also means that the image of b is really only the first (n-1) components, which is why invlink(dist, [0.0, 0.0]) == invlink(dist, [0.0, 1.0])
. So when you do project, invlink
is only bijective on ℝⁿ⁻¹ ⊂ ℝⁿ i.e. first (n - 1) components. You can do link(dist, x; proj = Val{false})
to not project, but without projection it might not result in a simplex.
The reasoning for the current approach is that it's compatible with the Dirichlet
distribution in the sense that you can do logpdf(dirichlet, invlink(x))
for any x ∈ ℝⁿ
(though it's not guaranteed to be one-to-one for any x
).
@mohamed82008 can probably answer this better:)
And whether or not this is the correct approach; I'm very open to a discussion as to whether or not we should it differently! Especially for the SimplexBijector
as that is meant to be "independent" of the distribution and it's currently the only Bijector
breaking the assumptions of a Bijector
. link
and invlink
takes the distribution as an argument so I think it's output ought to be compatible with the Dirichlet
distribution, as it is now.
from bijectors.jl.
Also it seems like the difference between the TransformVariables.jl and Bijectors.jl is the following:
y[end] = stick
vs.
Lines 209 to 213 in 45ec713
That is, in Bijectors.jl it's optional to project (proj = true
) onto the image of the transformation b: Kⁿ⁻¹ → ℝⁿ⁻¹ ⊆ ℝⁿ, denoted im(b)
. In the case when y ∈ im(b) ⊆ ℝⁿ
it doesn't matter whether or not you "project", i.e. both proj = true
and proj = false
is going to give to the same result from invlink
. But when you're no longer inside im(b)
, TransformVariables.jl's transform and invlink
with proj = false
is going to result in the same x ∈ ℝⁿ
which is not going to be in the simplex Kⁿ⁻¹ thus not in the support of Dirichlet
.
Because of the above, it seems to me that with proj = false
and TransformVariables.jl's impls you could potentially run into issues if the HMC trajectory takes a step outside of the im(b)
, which is why we default to proj = true
. Have you tried this in TransformVariables.jl @cscherrer ?
FWIW, there's another ℝⁿ⁻¹ → ℝⁿ implementation in HMCUtilities.jl.
So this is basically what Bijectors.jl is doing with proj = true
, but we represent it using a n
dim vector with the last element set to zero.
from bijectors.jl.
That Dirichlet bijector is getting a lot of attention here and on Slack and discourse, I am kind of glad! FWIW, I don't think our implementation is wrong in any conceptual way, it's confusing but it is not wrong, and we have good tests to back this claim up. But I do think we have issues with numerical stability where some scenarios can cause log
of some tiny negative number. I tried to battle this in the implementation but something seems to have slipped through. @torfjelde's answers are correct.
from bijectors.jl.
Related Issues (20)
- rational quadratic flows not supporting Float32 input HOT 1
- What to do with `CorrBijector` ? HOT 1
- Improve `PDVecBijector`
- Matrix factorization bijectors HOT 4
- Domain Error for VecCholeskyBijector bijector when calling logabsdetjac HOT 4
- Question on simplex bijector implementation HOT 9
- Can't apply Bijectors.ordered to TDist() and MvTDist() HOT 1
- Incorrect bijector for heterogeneous Product distribution HOT 3
- Radial flow to a simplex HOT 5
- Stackoverflow in custom bijector HOT 2
- Missing implementation of `Bijectors.bijector` for `arraydist` distributions. HOT 1
- Bijectors.ordered and MvLogNormal interaction .. only supported for unconstrained distributions. HOT 1
- `TruncatedBijectors` not defined in `Distributions` extension
- support ProductDistribution HOT 3
- Fixes to correlation bijectors
- Improve `with_logabsdet_jacobian` performance for `SimplexBijector` HOT 1
- Tests are failing for `VecCorrBijector` in _very_ rare scenarios
- Add Tapir to Bijectors tests. HOT 2
- README links to dead docs HOT 2
- StackOverflow on calling inverse VecCorrBijector with a multidimensional array
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bijectors.jl.