pub trait Consensus<E, Data>where
E: Estimator<Data>,{
type Inliers: IntoIterator<Item = usize>;
// Required methods
fn model<I>(&mut self, estimator: &E, data: I) -> Option<E::Model>
where I: Iterator<Item = Data> + Clone;
fn model_inliers<I>(
&mut self,
estimator: &E,
data: I,
) -> Option<(E::Model, Self::Inliers)>
where I: Iterator<Item = Data> + Clone;
}
Expand description
A consensus algorithm extracts a consensus from an underlying model of data. This consensus includes a model of the data and which datapoints fit the model.
Note that all the consensus methods take a &mut self
. This allows the consensus to store
state such as an RNG or pre-allocated memory. This means multiple threads will be forced
to create their own Consensus
instance, which is most efficient.
Required Associated Types§
Sourcetype Inliers: IntoIterator<Item = usize>
type Inliers: IntoIterator<Item = usize>
Iterator over the indices of the inliers in the clonable iterator.
Required Methods§
Sourcefn model<I>(&mut self, estimator: &E, data: I) -> Option<E::Model>
fn model<I>(&mut self, estimator: &E, data: I) -> Option<E::Model>
Takes a slice over the data and an estimator instance.
It returns None
if no valid model could be found for the data and
Some
if a model was found.
Make sure to shuffle your data
before calling this. You can use
SliceRandom::shuffle
.
Sourcefn model_inliers<I>(
&mut self,
estimator: &E,
data: I,
) -> Option<(E::Model, Self::Inliers)>
fn model_inliers<I>( &mut self, estimator: &E, data: I, ) -> Option<(E::Model, Self::Inliers)>
Takes a slice over the data and an estimator instance.
It returns None
if no valid model could be found for the data and
Some
if a model was found. It includes the inliers consistent with the model.
Make sure to shuffle your data
before calling this. You can use
SliceRandom::shuffle
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.