Skip to content

Comparing distributions #560

@peterhj

Description

@peterhj

Given an arbitrary distribution w/ parameters, e.g. Uniform or Normal, we might want to compare its parameters to those of another distribution of the same type. Depending on how we come across these structs, we might not easily have access to the underlying distribution parameters. I've thought of a few considerations:

  1. Is it worth implementing some way of comparing the distributions in rand?

  2. How should comparison be implemented? Float types generally only implement PartialEq, so doesn't necessarily make sense for Distribution to generally require Eq, only PartialEq. Alternatively, one could introduce a new trait with a method fn dist_eq(&self, other: &Self) -> bool to be implemented by comparable distributions. Even more simply, one could manually expose the distribution parameters on a per-distribution basis, e.g. add Normal::mean and Normal::std_dev functions, and leave comparison to the user.

  3. Related to (2), it might be possible that distributions with the same "public" parameters may be implemented with different "private" parameters that determine how samples are drawn from an RNG. Would this complicate the notion of comparing distributions?

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions