logo
pub trait Trainable<Observation> {
    fn train_baum_welch(
        &self,
        observations: &[Vec<Observation>],
        n_iter: Option<usize>,
        tol: Option<f64>
    ) -> (Array1<LogProb>, Array2<LogProb>, Array2<LogProb>, Array1<LogProb>);
fn update_matrices(
        &self,
        transition_hat: Array2<LogProb>,
        observation_hat: Array2<LogProb>,
        initial_hat: Array1<LogProb>,
        end_hat: Array1<LogProb>
    ); }
Expand description

A trait for trainning Hidden Markov Models (HMM) with generic Observation type using Baum-Welch algorithm.

Required methods

Iterative procedure to train the model using Baum-Welch algorithm given the training sequences.

As arguments, a set of sequences (observations) and two optional argumets: maximum number of iterations (n_iter) and tolerance (tol). The baum-welch iterative training procedure will stop either if it reaches the tolerance of the relative log-likelihood augmentation (default 1e-6) or exceed the maximum number of iterations (default 500).

This feature comes in handy in Bam-Welch algorithm when doing an update of HMM parameters.

After receiving the estimated parameters found after trainning, this method updates the values in the HMM model.

Implementors