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 marginalize method for certain distributions #4

Open
bencottier opened this issue Mar 9, 2021 · 1 comment
Open

Add marginalize method for certain distributions #4

bencottier opened this issue Mar 9, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@bencottier
Copy link
Contributor

For Distributions in the exponential family, e.g. MvNormal and GenericMvTDist, the marginal can be computed simply by dropping the parameters of the marginalised variates (Wikipedia).

So we can add a marginalize method for these cases which uses the lookup syntax (#3) under the hood. This would just be for clarity.

MWE:

julia> m = KeyedArray([0.1, 0.2, 0.3], [:a, :b, :c]);

julia> d = MvNormal(m);

julia> kd = KeyedDistribution(d)

julia> marginalize(kd, [:a, :c])
KeyedDistribution{Multivariate,Continuous,MvNormal{Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},KeyedArray{Float64,1,Array{Float64,1},Base.RefValue{Array{Symbol,1}}}}}(
d: MvNormal{Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},KeyedArray{Float64,1,Array{Float64,1},Base.RefValue{Array{Symbol,1}}}}(
dim: 2
μ: [0.1, 0.3]
Σ: [1.0 0.0; 0.0 1.0]
)

keys: [:a, :c]
)
@oxinabox
Copy link
Member

oxinabox commented Mar 9, 2021

cf JuliaStats/Distributions.jl#1238

@bencottier bencottier added the enhancement New feature or request label Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants