Expand description
§T-Digest Rust Library
This library provides an implementation of the t-digest algorithm in Rust. The t-digest algorithm is a data structure for accurate on-line accumulation of rank-based statistics such as quantiles and trimmed means.
§Features
- Efficient computation of quantiles over streaming data.
- Suitable for large datasets and distributed systems.
- Supports merging of t-digests from different data partitions.
§Example
use tdigests::TDigest;
// Create a t-digest from a list of values
let values = vec![10.0, 20.0, 30.0];
let mut digest = TDigest::from_values(values);
// Compress the centroids with a maximum of 100 centroids
digest.compress(100);
// Estimate quantiles
let median = digest.estimate_quantile(0.5);
assert_eq!(median, 20.0);
// Compute the relative rank of a value
let rank = digest.estimate_rank(25.0);
assert_eq!(rank, 0.75);