Crates.io | tdigests |
lib.rs | tdigests |
version | 0.1.1 |
source | src |
created_at | 2024-10-31 12:25:16.866681 |
updated_at | 2024-10-31 12:45:05.384919 |
description | An efficient Rust implementation of the t-digest algorithm. |
homepage | |
repository | https://github.com/andylokandy/tdigests |
max_upload_size | |
id | 1429947 |
size | 47,570 |
An efficient Rust implementation of the t-digest algorithm, which allows accurate estimation of quantiles and relative rank over streaming data.
Add the following to your Cargo.toml
:
[dependencies]
tdigests = 0.1
use tdigests::TDigest;
fn main() {
// Create a new t-digest
let digest = TDigest::from_values(vec![1.0, 2.0, 3.0]);
// Estimate quantiles
let median = digest.estimate_quantile(0.5);
println!("Estimated median: {}", median);
// Estimate rank
let rank = digest.estimate_rank(2.5);
println!("Rank of 2.5: {}", rank);
}
See the simple.rs
for a complete example demonstrating how to use the t-digest library.
Contributions are welcome! Please open issues or submit pull requests on the GitHub repository.
This project is licensed under the MIT License.