Trait ndarray_stats::histogram::strategies::BinsBuildingStrategy[][src]

pub trait BinsBuildingStrategy {
    type Elem: Ord;
    fn from_array<S>(array: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError>
    where
        S: Data<Elem = Self::Elem>,
        Self: Sized
;
fn build(&self) -> Bins<Self::Elem>;
fn n_bins(&self) -> usize; }

A trait implemented by all strategies to build Bins with parameters inferred from observations.

This is required by GridBuilder to know how to build a Grid’s projections on the coordinate axes.

Associated Types

Loading content...

Required methods

fn from_array<S>(array: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError> where
    S: Data<Elem = Self::Elem>,
    Self: Sized
[src]

Returns a strategy that has learnt the required parameter fo building Bins for given 1-dimensional array, or an Err if it is not possible to infer the required parameter with the given data and specified strategy.

Errors

See each of the struct-level documentation for details on errors an implementor may return.

fn build(&self) -> Bins<Self::Elem>[src]

Returns a Bins instance, according to parameters inferred from observations.

fn n_bins(&self) -> usize[src]

Returns the optimal number of bins, according to parameters inferred from observations.

Loading content...

Implementors

impl<T> BinsBuildingStrategy for Auto<T> where
    T: Ord + Clone + FromPrimitive + NumOps + Zero
[src]

type Elem = T

fn from_array<S>(a: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError> where
    S: Data<Elem = Self::Elem>, 
[src]

Returns Err(BinsBuildError::Strategy) if IQR==0. Returns Err(BinsBuildError::EmptyInput) if a.len()==0. Returns Ok(Self) otherwise.

impl<T> BinsBuildingStrategy for FreedmanDiaconis<T> where
    T: Ord + Clone + FromPrimitive + NumOps + Zero
[src]

type Elem = T

fn from_array<S>(a: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError> where
    S: Data<Elem = Self::Elem>, 
[src]

Returns Err(BinsBuildError::Strategy) if IQR==0. Returns Err(BinsBuildError::EmptyInput) if a.len()==0. Returns Ok(Self) otherwise.

impl<T> BinsBuildingStrategy for Rice<T> where
    T: Ord + Clone + FromPrimitive + NumOps + Zero
[src]

type Elem = T

fn from_array<S>(a: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError> where
    S: Data<Elem = Self::Elem>, 
[src]

Returns Err(BinsBuildError::Strategy) if the array is constant. Returns Err(BinsBuildError::EmptyInput) if a.len()==0. Returns Ok(Self) otherwise.

impl<T> BinsBuildingStrategy for Sqrt<T> where
    T: Ord + Clone + FromPrimitive + NumOps + Zero
[src]

type Elem = T

fn from_array<S>(a: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError> where
    S: Data<Elem = Self::Elem>, 
[src]

Returns Err(BinsBuildError::Strategy) if the array is constant. Returns Err(BinsBuildError::EmptyInput) if a.len()==0. Returns Ok(Self) otherwise.

impl<T> BinsBuildingStrategy for Sturges<T> where
    T: Ord + Clone + FromPrimitive + NumOps + Zero
[src]

type Elem = T

fn from_array<S>(a: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError> where
    S: Data<Elem = Self::Elem>, 
[src]

Returns Err(BinsBuildError::Strategy) if the array is constant. Returns Err(BinsBuildError::EmptyInput) if a.len()==0. Returns Ok(Self) otherwise.

Loading content...