statrs-dev / statrs

Statistical computation library for Rust
https://docs.rs/statrs/latest/statrs/
MIT License
599 stars 84 forks source link

All distributions should implement suitable `statistics` module traits. #276

Open YeungOnion opened 2 months ago

YeungOnion commented 2 months ago

Noticed while reviewing #275 that we're missing some of the support traits (Min, Max) for multinomial. There may be others to find as well.

soumyasen1809 commented 1 month ago

@YeungOnion I can try working on this one. if it is okay.

Also, 1 question: Minimum Value is 0, and Maximum Value is the total number of trials, n. Is my understanding correct?

YeungOnion commented 1 month ago

Sorry about the delay in reply,

Minimum Value is 0, and Maximum Value is the total number of trials, n.

I believe I posted the issue thinking that the above sentiment was correct. All 0 or all n, it is analogous to the impl for MultivariateNormal. However, I suppose that Max and Min for multivariate distributions are not clear.

Perhaps we could flesh out the use case of these kinds of values and then reimplement the useful trait, whether or not it maintains its name and signature. At the moment, I don't see a generic programming usage for Max and Min, i.e. I wouldn't use them as trait bounds. Further, we don't express inclusivity/exclusivity on those bounds, but I'm rambling, apologies.

--

For actionable steps, I've a list below. [^obvious]


As an open question for some design, how might we reformulate this API to express something that users or contributors to statrs may wish to generically program over or use? Just to toss my own ideas into the air,

Feel free to rename or open a new issue for that part as well. Thanks for your help!

[^obvious]: I use the word "obvious" to convey a very low degree of unexpectedness or very little ambiguity in behavior when a user sees the trait with it's trait level docs and sees that a given type implements it, but does not see the implementation or impl-level docs