FriesischScott / UncertaintyQuantification.jl

Uncertainty Quantification in Julia
MIT License
31 stars 11 forks source link

Interface for joint distributions #226

Open FriesischScott opened 2 weeks ago

FriesischScott commented 2 weeks ago

We need a general interface for various joint distributions. I think a parameterized struct could work well here. In this we can wrap for example SklarDist from Copulas.jl, MvNormal from Distributions.jl and Sliced Normals/Exponentials.

struct JointDistribution{T} <:RandomUQInput begin
    dist::T
    names::Vector{Symbol}

This would allow us to define mappings for dispatch for distinct types.

function to_standard_normal_space!(JointDistribution{MvNormal}, df::DataFrame)
...
end

function to_standard_normal_space!(JointDistribution{SlicedNormal}, df::DataFrame)
    error("SlicedNormals can not be mapped to standard normal space.")
end
AnderGray commented 2 weeks ago

Yes, sounds good. We could alternatively think about decomposing the joints into a copula + marginals if we know it has a closed form (e.g. Normal).

AnderGray commented 2 weeks ago

For sliced normals, we might be able to use transport maps from @jgrashorn

FriesischScott commented 2 weeks ago

For sliced normals, we might be able to use transport maps from @jgrashorn

I'll believe that when I see it :D

FriesischScott commented 2 weeks ago

Yes, sounds good. We could alternatively think about decomposing the joints into a copula + marginals if we know it has a closed form (e.g. Normal).

For the MvNormal that should work. Not sure how well it generalizes for other mulivariate distributions.

AnderGray commented 2 weeks ago

For sliced normals, we might be able to use transport maps from @jgrashorn

I'll believe that when I see it :D

It should be possible, it's a polynomial mapping from SNS to some other distribution of the same dimensions. I think you fit them by minimising some divergence (KL-divergence?). So if we can compute the KL divergence between the sliced normal and some other distribution, should be possible.

But I think you can fit the TM directly to a dataset, so it might be better to just do that. And it can also be the case that the sliced normal is more flexible than the TMs.