Crates.io | probs |
lib.rs | probs |
version | 0.3.1 |
source | src |
created_at | 2022-02-13 12:40:45.841927 |
updated_at | 2022-02-18 10:21:01.003911 |
description | Statistics toolkit |
homepage | |
repository | https://github.com/mrlazy1708/probs |
max_upload_size | |
id | 531745 |
size | 21,134 |
Provide definition of domain
and basic distribution
. Implement various sampler
with Iterator
.
Construct a sampler of certain sampling technique
use sampler::Global;
fn test() {
sampler::univar::Icdf::new()
Sample a distribution with it
.sample(distribution::univar::normal::<i8>(0.0, 32.0))
Use it like an Iterator
as you would
.enumerate()
.for_each(|(i, x)| println!("sample#{}: {}", i, x))
}
ANY customized distribution can be sampled with provided samplers
sampler::univar::Icdf::new()
.sample(|x: &u8| (x % 8) as f64)
Gibbs Sampler is used to sample distribution on high dimension
sampler::univar::Icdf::new()
.gibbs(nd::Dim([2, 2]), 100) // 2x2 domain; skip first 100 samples
.sample(|m: &nd::Array2<u8>| m.sum() as f64)