pub struct TDigest { /* private fields */ }Expand description
T-Digest for streaming quantile estimation
Provides accurate quantile estimates with bounded memory usage. Based on the algorithm by Ted Dunning.
Implementations§
Source§impl TDigest
impl TDigest
Sourcepub fn new(compression: f64) -> Self
pub fn new(compression: f64) -> Self
Create a new T-Digest with given compression factor
Compression of 100 is a good default. Higher values give more accuracy.
Sourcepub fn add_weighted(&mut self, value: f64, weight: f64)
pub fn add_weighted(&mut self, value: f64, weight: f64)
Add a value with weight
Sourcepub fn num_centroids(&self) -> usize
pub fn num_centroids(&self) -> usize
Get number of centroids
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Deserialize from bytes
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TDigest
impl<'de> Deserialize<'de> for TDigest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TDigest
impl RefUnwindSafe for TDigest
impl Send for TDigest
impl Sync for TDigest
impl Unpin for TDigest
impl UnsafeUnpin for TDigest
impl UnwindSafe for TDigest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.