From 1abbd0fe1dc97d79389b338b316c56e1b67f04c3 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Fri, 17 Jun 2022 17:55:45 +0200 Subject: [PATCH 1/4] WIP Add vartransform documentation --- docs/make.jl | 1 + docs/src/vartransform.md | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 docs/src/vartransform.md diff --git a/docs/make.jl b/docs/make.jl index 983991b4..4d3d3f2e 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -9,6 +9,7 @@ pages = [ "Tutorials" => [ "Adding a new measure" => "adding.md", "Affine transformations" => "affine.md", + "Variate transformations" => "vartransform.md", ], "API Reference" => [ "MeasureBase" => "api_measurebase.md", diff --git a/docs/src/vartransform.md b/docs/src/vartransform.md new file mode 100644 index 00000000..719d73b5 --- /dev/null +++ b/docs/src/vartransform.md @@ -0,0 +1,7 @@ +# Variate Transformations + +Given a measure `v` that can be seen as a [pushforward measure](https://en.wikipedia.org/wiki/Pushforward_measure) of a measure `μ` one often needs to find the [pushforward measure](https://en.wikipedia.org/wiki/Pushforward_measure) from `μ` to `v`. + +A typical application arises in sampling: Many sampling algorithms perform better or even require a specific base measure. Nested sampling, for example, natively uses μ as it's base measure, while many MCMC sampling algorithms work best in an unbounded space and prefer base measures such as `μ = StdNormal()^n`. Using [`vartransform`](@ref) we can (for many measures) automatically generate a function `f = vartransform(v, μ)` so that [`pushfwd(f, μ)`](@ref) becomes equivalent to `v`. Instead of sampling `∫(L, v)` we can now sample `∫(L∘f, μ)`. The generates sample points `X_μ` can then be transformed to sample points `X_v = f.(X_μ)`. + +Transformation functions `f = vartransform(v, μ)` support `f_inverse = InverseFunctions.inverse(f)` and `x_v, ladj = ChangesOfVariables.with_logabsdet_jacobian(f, x_μ)`. From d4c407bc401ee43e909df6c89739b1dac7b7a274 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Sat, 18 Jun 2022 03:20:47 +0200 Subject: [PATCH 2/4] Update docs/src/vartransform.md Co-authored-by: Moritz Schauer --- docs/src/vartransform.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/src/vartransform.md b/docs/src/vartransform.md index 719d73b5..279dfdbf 100644 --- a/docs/src/vartransform.md +++ b/docs/src/vartransform.md @@ -1,6 +1,8 @@ # Variate Transformations -Given a measure `v` that can be seen as a [pushforward measure](https://en.wikipedia.org/wiki/Pushforward_measure) of a measure `μ` one often needs to find the [pushforward measure](https://en.wikipedia.org/wiki/Pushforward_measure) from `μ` to `v`. +Often one needs to find a map `f` that transports samples of probability measure `μ` into samples of another probability measure `v`. More generally, `μ` to `v` can be measures. Then `v` is the [pushforward measure](https://en.wikipedia.org/wiki/Pushforward_measure) of measure `μ` under such `f`. + +Using [`vartransform`](@ref) we can (for many measures) automatically generate this function `f = vartransform(v, μ)` so that [`pushfwd(f, μ)`](@ref) becomes equal to `v`. Instead of sampling `∫(L, v)` we can now sample `∫(L∘f, μ)` by transforming the sampled points `X_μ` to sample points `X_v = f.(X_μ)`. A typical application arises in sampling: Many sampling algorithms perform better or even require a specific base measure. Nested sampling, for example, natively uses μ as it's base measure, while many MCMC sampling algorithms work best in an unbounded space and prefer base measures such as `μ = StdNormal()^n`. Using [`vartransform`](@ref) we can (for many measures) automatically generate a function `f = vartransform(v, μ)` so that [`pushfwd(f, μ)`](@ref) becomes equivalent to `v`. Instead of sampling `∫(L, v)` we can now sample `∫(L∘f, μ)`. The generates sample points `X_μ` can then be transformed to sample points `X_v = f.(X_μ)`. From 0c0d193965788ea853d30eb314aac950889a5fe5 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Sat, 18 Jun 2022 03:23:31 +0200 Subject: [PATCH 3/4] Update docs/src/vartransform.md Co-authored-by: Moritz Schauer --- docs/src/vartransform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/vartransform.md b/docs/src/vartransform.md index 279dfdbf..bad97094 100644 --- a/docs/src/vartransform.md +++ b/docs/src/vartransform.md @@ -4,6 +4,6 @@ Often one needs to find a map `f` that transports samples of probability measure Using [`vartransform`](@ref) we can (for many measures) automatically generate this function `f = vartransform(v, μ)` so that [`pushfwd(f, μ)`](@ref) becomes equal to `v`. Instead of sampling `∫(L, v)` we can now sample `∫(L∘f, μ)` by transforming the sampled points `X_μ` to sample points `X_v = f.(X_μ)`. -A typical application arises in sampling: Many sampling algorithms perform better or even require a specific base measure. Nested sampling, for example, natively uses μ as it's base measure, while many MCMC sampling algorithms work best in an unbounded space and prefer base measures such as `μ = StdNormal()^n`. Using [`vartransform`](@ref) we can (for many measures) automatically generate a function `f = vartransform(v, μ)` so that [`pushfwd(f, μ)`](@ref) becomes equivalent to `v`. Instead of sampling `∫(L, v)` we can now sample `∫(L∘f, μ)`. The generates sample points `X_μ` can then be transformed to sample points `X_v = f.(X_μ)`. +A typical application arises in nested sampling which natively uses `μ` as its base measure, while many MCMC sampling algorithms work best in an unbounded space and prefer base measures such as `μ = StdNormal()^n`. Transformation functions `f = vartransform(v, μ)` support `f_inverse = InverseFunctions.inverse(f)` and `x_v, ladj = ChangesOfVariables.with_logabsdet_jacobian(f, x_μ)`. From 34e8850f4ddf35fc6b8c2f5945807bfb83af9e23 Mon Sep 17 00:00:00 2001 From: Oliver Schulz Date: Sat, 18 Jun 2022 03:27:10 +0200 Subject: [PATCH 4/4] Improve vartransforms docs --- docs/src/vartransform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/vartransform.md b/docs/src/vartransform.md index bad97094..3c0ce937 100644 --- a/docs/src/vartransform.md +++ b/docs/src/vartransform.md @@ -4,6 +4,6 @@ Often one needs to find a map `f` that transports samples of probability measure Using [`vartransform`](@ref) we can (for many measures) automatically generate this function `f = vartransform(v, μ)` so that [`pushfwd(f, μ)`](@ref) becomes equal to `v`. Instead of sampling `∫(L, v)` we can now sample `∫(L∘f, μ)` by transforming the sampled points `X_μ` to sample points `X_v = f.(X_μ)`. -A typical application arises in nested sampling which natively uses `μ` as its base measure, while many MCMC sampling algorithms work best in an unbounded space and prefer base measures such as `μ = StdNormal()^n`. +A typical application arises in nested sampling which natively uses `μ = StdUniform()^n` as its base measure, while many MCMC sampling algorithms work best in an unbounded space and prefer base measures such as `μ = StdNormal()^n` or `μ = StdLogistic()^n`. Transformation functions `f = vartransform(v, μ)` support `f_inverse = InverseFunctions.inverse(f)` and `x_v, ladj = ChangesOfVariables.with_logabsdet_jacobian(f, x_μ)`.