Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basemeasure method for discrete Distributions #165

Open
cscherrer opened this issue Oct 19, 2021 · 0 comments
Open

Add basemeasure method for discrete Distributions #165

cscherrer opened this issue Oct 19, 2021 · 0 comments

Comments

@cscherrer
Copy link
Collaborator

cscherrer commented Oct 19, 2021

@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 cscherrer/Soss.jl#305?

Originally posted by @devmotion in JuliaGaussianProcesses/AbstractGPs.jl#206 (comment)

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> 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> typeof(Dists.Poisson(3)) |> supertype
Distributions.Distribution{Distributions.Univariate, Distributions.Discrete}
@cscherrer cscherrer changed the title Soss tests failing in AbstractGPs Add basemeasure method for discrete Distributions Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant