Skip to content

Implement Ordered distribution factory #7297

Open
@ricardoV94

Description

@ricardoV94

Description

For univariate IID, adding a transform=ordered is equivalent to sorting the raw draws (forward pass). The logp is proportional to the density of the original draws + ordered transform jacobian. We would just need to figure out the normalization constant so it defines a proper multivariate variable that integrates to 1.

With this users would have a generative graph for ordered variables, that they can also do prior_predictive sampling from.
Also default initvals would work out of the box. Right now users always need to provide them.

This would also pretty much also obliviate the need for default_transform and transform that we added in #5674 and simplify the API.

The normalization constant is probably just size!: https://en.wikipedia.org/wiki/Order_statistic#The_joint_distribution_of_the_order_statistics_of_an_absolutely_continuous_distribution

The API could look something like:

with pm.Model() as m:
  x = pm.Ordered("x", pm.Normal.dist(), shape=(3,))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions