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.

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

Associated Types

type Elem: Ord[src]

Loading content...

Required methods

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

Given some observations in a 1-dimensional array it returns a BinsBuildingStrategy that has learned the required parameter to build a collection of Bins.

It returns Err if it is not possible to build a collection of Bins given the observed data according to the chosen strategy.

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

Returns a Bins instance, built accordingly to the parameters inferred from observations in from_array.

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

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

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...