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

Support for Multivariate distributions is not implemented #11

Closed
Nimrais opened this issue Apr 18, 2024 · 3 comments
Closed

Support for Multivariate distributions is not implemented #11

Nimrais opened this issue Apr 18, 2024 · 3 comments

Comments

@Nimrais
Copy link
Member

Nimrais commented Apr 18, 2024

Right now, if someone will try to run an EM like inference on an edge with multivariate incoming messages in RxInfer he will obtain an error like this

MethodError: no method matching support(::MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}})
Closest candidates are:
  support(!Matched::Type{NegativeBinomial})
   @ ExponentialFamily [~/.julia/packages/ExponentialFamily/QIygk/src/distributions/negative_binomial.jl:10](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/.julia/packages/ExponentialFamily/QIygk/src/distributions/negative_binomial.jl:10)
  support(!Matched::Type{NormalGamma})
   @ ExponentialFamily [~/.julia/packages/ExponentialFamily/QIygk/src/distributions/normal_gamma.jl:102](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/.julia/packages/ExponentialFamily/QIygk/src/distributions/normal_gamma.jl:102)
  support(!Matched::ContinuousMultivariateLogPdf)
   @ BayesBase [~/.julia/packages/BayesBase/ZObVB/src/densities/function.jl:191](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/.julia/packages/BayesBase/ZObVB/src/densities/function.jl:191)
  ...
Stacktrace:
  [1] support(product::ProductOf{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, LinearizedProductOf{ContinuousMultivariateLogPdf{UnspecifiedDomain}}})
    @ BayesBase [~/.julia/packages/BayesBase/ZObVB/src/prod.jl:182](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/.julia/packages/BayesBase/ZObVB/src/prod.jl:182)
  [2] logpdf(product::ProductOf{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, LinearizedProductOf{ContinuousMultivariateLogPdf{UnspecifiedDomain}}}, x::Vector{Float64})
    @ BayesBase [~/.julia/packages/BayesBase/ZObVB/src/prod.jl:188](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/.julia/packages/BayesBase/ZObVB/src/prod.jl:188)
  [3] (::var"#158#159"{ProductOf{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, LinearizedProductOf{ContinuousMultivariateLogPdf{UnspecifiedDomain}}}})(x::Vector{Float64})
    @ Main [~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:30](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:30)
  [4] myADAMoptimizer(func::var"#158#159"{ProductOf{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, LinearizedProductOf{ContinuousMultivariateLogPdf{UnspecifiedDomain}}}}, init_value::Vector{Float64}, η::Float64; β1::Float64, β2::Float64, ϵ::Float64, niter::Int64)
    @ Main [~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:9](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:9)
  [5] myADAMoptimizer(func::Function, init_value::Vector{Float64}, η::Float64)
    @ Main [~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:1](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:1)
  [6] default_point_mass_form_constraint_optimizer(::Type{Multivariate}, ::Type{Continuous}, constraint::PointMassFormConstraint{typeof(RxInfer.default_point_mass_form_constraint_optimizer), var"#151#152", typeof(RxInfer.default_point_mass_form_constraint_boundaries)}, distribution::ProductOf{MvNormalMeanCovariance{Float64, Vector{Float64}, Matrix{Float64}}, LinearizedProductOf{ContinuousMultivariateLogPdf{UnspecifiedDomain}}})
    @ Main [~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:32](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/PhD/GaussianProcessNode/newconfig_gpnode.ipynb:32)
...
    @ RxInfer [~/PhD/RxInfer.jl/src/inference/batch.jl:300](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/PhD/RxInfer.jl/src/inference/batch.jl:300)
 [71] batch_inference
    @ RxInfer [~/PhD/RxInfer.jl/src/inference/batch.jl:94](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/PhD/RxInfer.jl/src/inference/batch.jl:94) [inlined]
 [72] #infer#230
    @ RxInfer [~/PhD/RxInfer.jl/src/inference/inference.jl:306](https://file+.vscode-resource.vscode-cdn.net/Users/nguyenhuuminhhoang/PhD/GaussianProcessNode/~/PhD/RxInfer.jl/src/inference/inference.jl:306) [inlined]
@Nimrais
Copy link
Member Author

Nimrais commented Apr 18, 2024

Before we had smt like UndefinedSupport if I am not wrong.

@bvdmitri
Copy link
Member

bvdmitri commented Apr 18, 2024

Good catch, it should really use insupport(product, x) instead of x ∈ support(product). The reason for this change was due to the fact its not always possible to create a support object (legacy from Distribuitions.jl, where they don't support infinite discrete ranges). So whenever possible, we should use insupport(distribution, x) instead. insupport should be properly defined for all members in ExponentialFamily.jl.

we probably overlooked this place when the change was introduced

@bvdmitri
Copy link
Member

Fixed in #14

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

2 participants