logo
pub struct Model { /* private fields */ }
Expand description

Implementation of a hmm::Model with emission values from discrete distributions and an optional declared end state.

Log-scale probabilities are used for numeric stability.

In Rabiner’s tutorial, a discrete emission value HMM has N states and M output symbols. The state transition matrix with dimensions NxN is A, the observation probability distribution is the matrix B with dimensions NxM and the initial state distribution pi has length N. We also included a silent end state ε with vector length N that do not emit symbols for modelling the end of sequences. It’s optional to supply the end probabilities at the creation of the model. If this happens, we’ll create a dummy end state to simulate as if the end state has not been included.

Implementations

Construct new Hidden MarkovModel with the given transition, observation, and initial state matrices and vectors already in log-probability space.

Construct new Hidden MarkovModel with the given transition, observation, and initial state matrices and vectors already as Prob values.

Construct new Hidden MarkovModel with the given transition, observation, and initial state matrices and vectors with probabilities as f64 values.

Trait Implementations

Formats the value using the given formatter. Read more

The number of states in the model.

Return iterator over the states of an HMM.

Returns an iterator of all transitions.

Transition probability between two states from and to.

Initial probability given the HMM state.

End probability given the HMM state.

Probability for the given observation in the given state.

Transition probability between two states from and to for observation with index _to_idx (index of to). Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.