rust-random / rand

A Rust library for random number generation.
https://crates.io/crates/rand
Other
1.67k stars 431 forks source link

probability density evaluation of a sampled item #1408

Closed jean-pierreBoth closed 8 months ago

jean-pierreBoth commented 8 months ago

Background

It is VERY often necessary after sampling x from a distribution (especially for weighted index) to have the probability of the x sampled. For example it is required to build acceptance rejection scheme (Bayes computation, McMc etc)

Feature request

In the Distribution trait add something like : fn sample_info() -> (T, F) with T object sampled and F: Float + ... giving the proba of likelyhood corresponding.

dhardy commented 8 months ago

This info is not always stored in the distribution objects. Can I suggest using statrs instead?

jean-pierreBoth commented 8 months ago

Ok, thanks.

Le mar. 12 mars 2024 à 12:01, Diggory Hardy @.***> a écrit :

This info is not always stored in the distribution objects. Can I suggest using statrs https://crates.io/crates/statrs instead?

— Reply to this email directly, view it on GitHub https://github.com/rust-random/rand/issues/1408#issuecomment-1991376415, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXM7NJKTHYKXI6OBGFFE4DYX3OABAVCNFSM6AAAAABER6MWXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJRGM3TMNBRGU . You are receiving this because you authored the thread.Message ID: @.***>