[−][src]Struct streamhist::StreamingHistogram
Implementations
impl StreamingHistogram
[src]
pub fn new(max_centroids: u16) -> StreamingHistogram
[src]
Creates new StreamingHistogram
max_centroids
indicates how many centroids should be used to estimate statistics, more centroids more accurate estimation. Each centroids stroesf64
andu64
and uses about 16 bytes of space.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); assert_eq!(hist.count(), 0)
Panics
The function panics if the max_centroids
is zero.
use streamhist::StreamingHistogram; // panics on empty histogram let mut hist = StreamingHistogram::new(0);
pub fn clear(&mut self)
[src]
Clearas all state like centroids and restests all counts.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); hist.insert_one(10.0); assert_eq!(hist.count(), 1); hist.clear(); assert_eq!(hist.count(), 0)
pub fn is_empty(&self) -> bool
[src]
Returns true if this histogram has no recorded values.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); assert!(hist.is_empty(), 1);
pub fn count(&self) -> u64
[src]
Returns number of items observed by histogram.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); assert_eq!(hist.count(), 0); hist.insert_one(10.0); assert_eq!(hist.count(), 1)
pub fn max(&self) -> Option<f64>
[src]
Returns max value ever observed by histogram.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); assert_eq!(hist.max(), None); hist.insert_one(10.0); assert!(hist.max().unwrap() > 9.0);
pub fn min(&self) -> Option<f64>
[src]
Returns min value ever observed by histogram.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); assert_eq!(hist.min(), None); hist.insert_one(10.0); assert!(hist.min().unwrap() > 9.0);
pub fn insert_one(&mut self, value: f64)
[src]
pub fn insert(&mut self, value: f64, count: u64)
[src]
pub fn mean(&self) -> Option<f64>
[src]
Returns estimate of mean value using centroids.
Note, it is possible to compute exact mean value over data stream using itertive algorithm. Estimate with centroids is resonably accurate try with your distribution.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); hist.insert(10.0, 1); assert!(hist.mean().unwrap() > 9.0);
pub fn var(&self) -> Option<f64>
[src]
Returns estimate of variance value using centroids.
Note, it is possible to compute exact mean value over data stream using itertive algorithm. Estimate with centroids is resonably accurate try with your distribution.
Example
use streamhist::StreamingHistogram; let mut hist = StreamingHistogram::new(32); hist.insert(10.0, 1); hist.insert(15.0, 1); assert!(hist.var().unwrap() < 7.0);
pub fn sum(&self, value: f64) -> u64
[src]
pub fn quantile(&self, q: f64) -> Option<f64>
[src]
pub fn median(&self) -> Option<f64>
[src]
pub fn merge(&mut self, other: &Self)
[src]
pub fn count_less_then_eq(&self, value: f64) -> u64
[src]
Trait Implementations
impl Clone for StreamingHistogram
[src]
pub fn clone(&self) -> StreamingHistogram
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for StreamingHistogram
[src]
impl Default for StreamingHistogram
[src]
pub fn default() -> StreamingHistogram
[src]
Creates new StreamingHistogram with default max_centroids=64
Auto Trait Implementations
impl RefUnwindSafe for StreamingHistogram
[src]
impl Send for StreamingHistogram
[src]
impl Sync for StreamingHistogram
[src]
impl Unpin for StreamingHistogram
[src]
impl UnwindSafe for StreamingHistogram
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,