JuliaMath / JuliaMath/MeasureTheory.jl
Add `basemeasure` method for discrete `Distribution`s
- Dominant language
- Julia
- Stars
- 401
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
> @cscherrer It seems some recent changes of Soss/MeasureTheory broke the tests: https://github.com/JuliaGaussianProcesses/AbstractGPs.jl/pull/206/checks?check_run_id=3858536599#step:6:962 and https://github.com/JuliaGaussianProcesses/AbstractGPs.jl/pull/206/checks?check_run_id=3858536599#step:6:1068. Tests passed on the master branch two weeks ago. Maybe it's related to https://github.com/cscherrer/Soss.jl/issues/305?
_Originally posted by @devmotion in https://github.com/JuliaGaussianProcesses/AbstractGPs.jl/issues/206#issuecomment-943696525_
FWIW this passes:
https://gist.github.com/cscherrer/f2788b7ab62a232eb42a3068fe2fe56c
But it looks these tests are using Distributions instead.
The problem seems to be here:
```julia
julia> using MeasureTheory
julia> basemeasure(Poisson(3))
CountingMeasure(ℤ[0:ℵ₀])
julia> basemeasure(Dists.Poisson(3))
ERROR: MethodError: no method matching basemeasure(::Distributions.Poisson{Float64})
Closest candidates are:
basemeasure(::Pullback{TransformVariables.CallableTransform{T}, Lebesgue{ℝ}}) where T<:TransformVariables.ScalarTransform at /home/chad/git/MeasureTheory.jl/src/combinators/transforms.jl:81
basemeasure(::Pullback) at /home/chad/git/MeasureTheory.jl/src/combinators/transforms.jl:63
basemeasure(::SuperpositionMeasure) at /home/chad/git/MeasureBase/src/combinators/superpose.jl:48
...
Stacktrace:
[1] top-level scope
@ REPL[3]:1
```
The solution is to add a `basemeasure` method for `Distributions.Discrete` so Poisson can use it, i.e.
```julia
julia> typeof(Dists.Poisson(3)) |> supertype
Distributions.Distribution{Distributions.Univariate, Distributions.Discrete}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.