JuliaMath / JuliaMath/MeasureBase.jl

Pushforward problems

Open
#125 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
32
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Say we have
```julia
using MeasureTheory, MeasureBase, BenchmarkTools, AffineMaps
μ = Normal(3.0, 2.0)
ν = pushfwd(MulAdd(2.0, 3.0), StdNormal())
x = rand(Normal(3.0, 2.0) ^ 100);
```

Then benchmarking gives
```julia
julia> @btime logdensityof($μ ^ 100, $x)
60.594 ns (0 allocations: 0 bytes)
-222.1504504107993

julia> @btime logdensityof($ν ^ 100, $x)
12.734 μs (12 allocations: 192 bytes)
-222.15045041079918
```

I'm also confused by the basemeasure sequence here:
```julia
julia> basemeasure_sequence(ν) .|> println;
PushforwardMeasure(MulAdd{Float64, Float64}(2.0, 3.0), StdNormal())
PushforwardMeasure(MulAdd{Float64, Float64}(2.0, 3.0), 0.3989 * MeasureBase.LebesgueBase())
PushforwardMeasure(MulAdd{Float64, Float64}(2.0, 3.0), MeasureBase.LebesgueBase())
```

I'd think there are always a couple of laws in place around these things:
```julia
logdensity_def(μ, x) == logdensity_rel(μ, basemeasure(μ), x)

logdensity_rel(pushfwd(f, μ), pushfwd(f, ν), x) == logdensity_rel(μ, ν, inverse(f)(x))
```

But then we'd expect `logdensityof(ν, x) == logdensityof(StdNormal(), x)`, which is not the case.

@oschulz any idea what's going on here?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.