| Crates.io | kuji |
| lib.rs | kuji |
| version | 0.1.0 |
| created_at | 2026-01-18 14:53:13.350958+00 |
| updated_at | 2026-01-18 14:53:13.350958+00 |
| description | Stochastic sampling primitives: Gumbel-Softmax, reservoir sampling, and latent permutations |
| homepage | https://github.com/arclabs561/kuji |
| repository | https://github.com/arclabs561/kuji |
| max_upload_size | |
| id | 2052435 |
| size | 59,152 |
Stochastic sampling primitives for unbiased data selection and stream processing. Implements reservoir sampling (Algorithm L/R), weighted sampling, and Gumbel-max for top-k.
Dual-licensed under MIT or Apache-2.0.
use kuji::reservoir::ReservoirSampler;
let mut sampler = ReservoirSampler::new(5);
for i in 0..100 {
sampler.add(i);
}
let samples = sampler.samples();
assert_eq!(samples.len(), 5);
cargo run --example weighted_topk: compare Gumbel-top-k (Plackett–Luce) vs weighted reservoir
(A-Res) on the same weight vector.