Skip to content

feat: Implementing the PartitionedDistributions interface #358

Description

@sethaxen

From @lrnv at JuliaStats/Distributions.jl#418 (comment):

@sethaxen A few questions:

  1. Have you seen what we did in Copulas.jl on the same subject ?

  2. Do you have specific bindings for multivriate distribution simplemented in Distributions.jl, or generic paths for any multivariate dist, or both ?

  3. Do you think we could implement some package extension to allow our interface to use your methods and/or vice-versa ?

RE (3), yes, I think implementing either/both interfaces in an extension would be very straightforward. To me it makes more sense to implement the PartitionedDistributions interface (in particular conditional/marginal) for Copula's distributions than the other way around (since I would guess any package using your interface does so because they assume a copula structure). The overloads could live anywhere, but I also think it makes more sense to be an extension here.

I'm working on a refactor to make PartitionedDistributions a little easier to extend, so if this plan sounds good, I can open a PR here with an extension when it's ready.

A few comments/notes:

  • PartitionedDistributions.conditional takes as arguments a point x in the support as well as the indices keep of the elements that remain in the support after conditioning. This is because for higher-dimensional array-variate distributions (Matrix-variate, etc), I found it much easier to type-inferrably determine the type of the output distribution if we can infer it directly from the user-provided input x[keep]. These indices are the inverse of those accepted by Copulas.condition.
  • I believe PartitionedDistributions.marginal and Copulas.subsetdims describe the same operation.
  • PartitionedDistributions.pointwise_conditional_logpdfs!! has a fallback method that works for anything that implements conditional, but often a more efficient implementation is available. I wonder if there's anything in your API or internal functions that would support this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions