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

Missing implementation of Bijectors.bijector for arraydist distributions. #294

Open
soldasim opened this issue Nov 16, 2023 · 1 comment

Comments

@soldasim
Copy link

soldasim commented Nov 16, 2023

It appears some implementations of Bijectors.bijector for distributions of type VectorOfMultivariate and MatrixOfUnivariate are missing.

Example:

using Turing

function script()
    dist = arraydist(
        fill(
            Product(fill(Normal(), 2)),  # does not work
            # MvLogNormal(zeros(2), ones(2)),  # does not work
            # MvNormal(zeros(2), ones(2)),  # works
            2
        )
    )

    @model function model()
        x ~ dist
    end

    iters = 10
    chain = sample(model(), NUTS(10, 0.65), iters)
    @show chain
end
julia> script()
ERROR: MethodError: no method matching bijector(::DistributionsAD.VectorOfMultivariate{Continuous, Product{Continuous, Normal{Float64}, Vector{Normal{Float64}}}, Vector{Product{Continuous, Normal{Float64}, Vector{Normal{Float64}}}}})

Closest candidates are:
  bijector(::Union{Kolmogorov, BetaPrime, Chi, Chisq, Erlang, Exponential, FDist, Frechet, Gamma, InverseGamma, InverseGaussian, LogNormal, NoncentralChisq, NoncentralF, Rayleigh, Weibull})
   @ Bijectors C:\Users\sheld\.julia\packages\Bijectors\QhObI\src\transformed_distribution.jl:102
  bijector(::Union{Arcsine, Beta, Biweight, Cosine, Epanechnikov, NoncentralBeta})
   @ Bijectors C:\Users\sheld\.julia\packages\Bijectors\QhObI\src\transformed_distribution.jl:113
  bijector(::Union{Levy, Pareto})
   @ Bijectors C:\Users\sheld\.julia\packages\Bijectors\QhObI\src\transformed_distribution.jl:116
  ...

I am not confident enough in my understanding of bijectors to make this into a PR.

EDIT: Added MvLogNormal to the example.

@devmotion devmotion transferred this issue from TuringLang/DistributionsAD.jl Nov 16, 2023
@soldasim
Copy link
Author

Additionally, the bijector for MvLogNormal seems to be broken.

When running the example above with MvLogNormal, I get the following:

julia> script()
ERROR: UndefVarError: `Log` not defined
Stacktrace:
  [1] bijector(d::DistributionsAD.VectorOfMultivariate{Continuous, MvLogNormal{Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Vector{Float64}}, Vector{MvLogNormal{Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, Vector{Float64}}}})
    @ BijectorsDistributionsADExt C:\Users\sheld\.julia\packages\Bijectors\QhObI\ext\BijectorsDistributionsADExt.jl:64

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