Skip to main content

BinsBuildingStrategy

Trait BinsBuildingStrategy 

Source
pub trait BinsBuildingStrategy {
    type Elem: Ord;

    // Required methods
    fn from_array(
        array: &ArrayRef<Self::Elem, Ix1>,
    ) -> Result<Self, BinsBuildError>
       where Self: Sized;
    fn build(&self) -> Bins<Self::Elem>;
    fn n_bins(&self) -> usize;
}
Expand description

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.

Required Associated Types§

Required Methods§

Source

fn from_array(array: &ArrayRef<Self::Elem, Ix1>) -> Result<Self, BinsBuildError>
where Self: Sized,

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.

Source

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

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

Source

fn n_bins(&self) -> usize

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§