Trait StreamingEm

Source
pub trait StreamingEm<const D: usize, R>: EmStep
where R: Rewind, R::Site: EmSite<D>,
{ // Required method fn stream_e_step( &mut self, sfs: Sfs<D>, reader: &mut R, ) -> Result<(Self::Status, USfs<D>)>; // Provided methods fn stream_em_step( &mut self, sfs: Sfs<D>, reader: &mut R, ) -> Result<(Self::Status, Sfs<D>)> { ... } fn stream_em<S>( &mut self, sfs: Sfs<D>, reader: &mut R, stopping_rule: S, ) -> Result<(Self::Status, Sfs<D>)> where S: Stop<Self, Status = Self::Status> { ... } }
Expand description

A type capable of running an EM-like algorithm for SFS inference by streaming through data.

Required Methods§

Source

fn stream_e_step( &mut self, sfs: Sfs<D>, reader: &mut R, ) -> Result<(Self::Status, USfs<D>)>

The E-step of the algorithm.

This should correspond to a full pass through the reader.

§Panics

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

Provided Methods§

Source

fn stream_em_step( &mut self, sfs: Sfs<D>, reader: &mut R, ) -> Result<(Self::Status, Sfs<D>)>

A full EM-step of the algorithm.

Like the Em::e_step, this should correspond to a full pass through the reader.

§Panics

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

Source

fn stream_em<S>( &mut self, sfs: Sfs<D>, reader: &mut R, stopping_rule: S, ) -> Result<(Self::Status, Sfs<D>)>
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, R> StreamingEm<D, R> for StandardEm<false>
where R: Rewind, R::Site: StreamEmSite<D>,

Source§

impl<const D: usize, R, T> StreamingEm<D, R> for WindowEm<D, T>
where R: Rewind, R::Site: EmSite<D>, for<'a> T: StreamingEm<D, Take<Enumerate<&'a mut R>>>,

Source§

impl<const D: usize, T, F, R> StreamingEm<D, R> for Inspect<T, F>
where R: Rewind, R::Site: EmSite<D>, T: StreamingEm<D, R>, F: FnMut(&T, &T::Status, &USfs<D>),