JuliaMath / JuliaMath/MeasureTheory.jl
Add more `distproxy`s
- Dominant language
- Julia
- Stars
- 401
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Rather than trying to rebuild all functionality from Distributions.jl, we're first focusing on reimplementing `logdensity` (`logpdf` in Distributions), and delegating most other functions to the current Distributions implementations.
So for example, we have
```julia
distproxy(d::Normal{(:μ, :σ)}) = Dists.Normal(d.μ, d.σ)
```
This makes some functions in Distributions.jl available through `distproxy.jl`:
```julia
PROXIES = Dict(
:Distributions => [
:mean
:std
:var
:entropy
:cdf
:quantile
],
:MonteCarloMeasurements => [
:Particles
]
)
for m in keys(PROXIES)
for f in PROXIES[m]
@eval begin
import $m: $f
export $f
$m.$f(d::AbstractMeasure, args...) = $m.$f(MeasureTheory.distproxy(d), args...)
end
end
end
```
So for example, without ever defining `cdf` explicitly, we get
```julia
julia> Dists.cdf(Normal(2,5),3.1)
0.5870644226482147
julia> @which Dists.cdf(Normal(2,5),3.1)
cdf(d::AbstractMeasure, args...) in MeasureTheory at /home/chad/git/MeasureTheory.jl/src/distproxy.jl:21
```
We need a `distproxy` for every parameterization. For example, we should have something like
```
distproxy(d::Normal{(:μ, :logσ)}) = Dists.Normal(d.μ, exp(d.logσ))
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.