pub trait BinsBuildingStrategy {
type Elem: Ord + Send;
// Required methods
fn from_array_with_max<S>(
array: &ArrayBase<S, Ix1>,
max_n_bins: usize,
) -> Result<Self, BinsBuildError>
where S: Data<Elem = Self::Elem>,
Self: Sized;
fn build(&self) -> Bins<Self::Elem>;
fn n_bins(&self) -> usize;
// Provided method
fn from_array<S>(array: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError>
where S: Data<Elem = Self::Elem>,
Self: Sized { ... }
}
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§
Sourcefn from_array_with_max<S>(
array: &ArrayBase<S, Ix1>,
max_n_bins: usize,
) -> Result<Self, BinsBuildError>
fn from_array_with_max<S>( array: &ArrayBase<S, Ix1>, max_n_bins: usize, ) -> Result<Self, BinsBuildError>
Returns a strategy that has learnt the required parameter for 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 implementation may
return. Fails if the strategy requires more bins than max_n_bins
.
Provided Methods§
Sourcefn from_array<S>(array: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError>
fn from_array<S>(array: &ArrayBase<S, Ix1>) -> Result<Self, BinsBuildError>
Returns a strategy that has learnt the required parameter for 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.
Calls Self::from_array_with_max
with max_n_bins
of u16::MAX
.
§Errors
See each of the struct
-level documentation for details on errors an implementation may
return.