JuliaMath / JuliaMath/MeasureBase.jl

Hitting `NoTransportOrigin` from weighted measures

Open
#93 3 comments 0 reactions 1 assignee Claimed by @oschulz View on GitHub
Dominant language
Julia
Stars
32
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The "transport origin" of a `WeightedMeasure` needs to be weighted. I had thought this might be easy:
```julia
transport_origin(ν::WeightedMeasure) = weightedmeasure(ν.logweight, transport_origin(ν.base))

to_origin(w::WeightedMeasure, y) = to_origin(w.base, y)
from_origin(w::WeightedMeasure, x) = from_origin(w.base, x)
```

but this leads us to
```julia
julia> MeasureBase.transport_origin(2.2 * StdNormal())
2.2 * MeasureBase.NoTransportOrigin{StdNormal}()
```

I understand that this is just how dispatch is set up for transports, but it's bitten me a few times, and I think it will be at least as confusing for new users as it has been for me. I think we can keep the current high-level functionality but change the dispatch patterns under the hood so it works more like `basemeasure`. That would also help new devs, because getting used to one (basemeasures or transports) will make the other easier.

@oschulz I could try to prototype this, but I know you're also working on improving type stability for transports, and I don't want us to collide more than we have to :)

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.