Probability distribution with complex object support (e.g. `Tuple{Integer, Matrix}`)

The Distributions.jl package has great support for continuous and discrete distributions over scalars, vectors, and matrices. Is it meant to support in any way probability distributions in which sampling would return a more complicated object, e.g. a tuple containing integers, symbols, matrices?

What would stop us from building those complicated objects ourselves with the given distributions? Are you thinking in any specific problem?

1 Like

I can build them myself, but I guess I am asking whether there is a “blessed” interface to follow.

I want a distribution which when sampled gives objects like Tuple{Ket, Real, Category} where Category is basically an enum and Ket is a struct containing a matrix and some metadata. It is easy for me to make an object that produces such samples, but I do not know whether other tools and libraries have expectations about interfaces.

The Distributions.jl documentation has a page on defining new distributions. You might have to adapt it a bit, but it will give you an idea of which methods you might want to extend for your distribution.

2 Likes