Em

Trait Em 

Source
pub trait Em<const N: usize, I>: EmStep {
    // Required method
    fn e_step(&mut self, sfs: Sfs<N>, input: &I) -> (Self::Status, USfs<N>);

    // Provided methods
    fn em_step(&mut self, sfs: Sfs<N>, input: &I) -> (Self::Status, Sfs<N>) { ... }
    fn em<S>(
        &mut self,
        sfs: Sfs<N>,
        input: &I,
        stopping_rule: S,
    ) -> (Self::Status, Sfs<N>)
       where S: Stop<Self, Status = Self::Status> { ... }
}
Expand description

A type capable of running an EM-like algorithm for SFS inference using data in-memory.

Required Methods§

Source

fn e_step(&mut self, sfs: Sfs<N>, input: &I) -> (Self::Status, USfs<N>)

The E-step of the algorithm.

This should correspond to a full pass over the input.

§Panics

Panics if the shapes of the SFS and the input do not match.

Provided Methods§

Source

fn em_step(&mut self, sfs: Sfs<N>, input: &I) -> (Self::Status, Sfs<N>)

A full EM-step of the algorithm.

Like the Em::e_step, this should correspond to a full pass over the input.

§Panics

Panics if the shapes of the SFS and the input do not match.

Source

fn em<S>( &mut self, sfs: Sfs<N>, input: &I, stopping_rule: S, ) -> (Self::Status, Sfs<N>)
where S: Stop<Self, Status = Self::Status>,

Runs the EM algorithm until convergence.

This consists of running EM-steps until convergence, which is decided by the provided stopping_rule. The converged SFS, and the status of the last EM-step, are returned.

§Panics

Panics if the shapes of the SFS and the input do not match.

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.

Implementors§

Source§

impl<const D: usize, I> Em<D, I> for StandardEm<false>
where for<'a> &'a I: IntoSiteIterator<D>,

Source§

impl<const D: usize, I> Em<D, I> for StandardEm<true>
where for<'a> &'a I: IntoParallelSiteIterator<D>,

Source§

impl<const D: usize, I, T> Em<D, I> for WindowEm<D, T>
where for<'a> &'a I: IntoBlockIterator<D>, for<'a> T: Em<D, <&'a I as IntoBlockIterator<D>>::Item>,

Source§

impl<const D: usize, T, F, I> Em<D, I> for Inspect<T, F>
where T: Em<D, I>, F: FnMut(&T, &T::Status, &USfs<D>),