learning-hmm-0.1.0.0: Yet another library for hidden Markov models

Safe HaskellNone
LanguageHaskell2010

Learning.HMM

Synopsis

Documentation

data HMM s o Source

Parameter set of the hidden Markov model. Direct use of the constructor is not recommended. Instead, call new.

Constructors

HMM 

Fields

states :: [s]

Hidden states

outputs :: [o]

Observed outputs

initialStateDist :: Categorical Double s

Categorical distribusion of initial states

transitionDist :: s -> Categorical Double s

Categorical distribution of next states conditioned by the previous states

emissionDist :: s -> Categorical Double o

Categorical distribution of outputs conditioned by the hidden states

Instances

(Show s, Show o) => Show (HMM s o) 

new :: (Ord s, Ord o) => [s] -> [o] -> HMM s o Source

Construct a HMM from the given states and outputs. The initialStateDist and emissionDist are set to be uniform distributions. The transitionDist is specified as follows: with probability 1/2, move to the same state, otherwise, move to a random state (which might be the same state).

viterbi :: (Eq s, Eq o) => HMM s o -> [o] -> ([s], LogLikelihood) Source

Perform the Viterbi algorithm and return the most likely state path and its log likelihood.

baumWelch :: (Eq s, Eq o) => HMM s o -> [o] -> [(HMM s o, LogLikelihood)] Source

Perform the Baum-Welch algorithm steps iteratively and return a list of updated HMM parameters and their corresponding log likelihoods.