hmm-lapack-0.3.0.2: Hidden Markov Models using LAPACK primitives

Safe HaskellNone
LanguageHaskell2010

Math.HiddenMarkovModel.Pattern

Description

This module provides a simple way to train the transition matrix and initial probability vector using simple patterns of state sequences.

You may create a trained model using semigroup combinators like this:

example :: HMM.DiscreteTrained Char (ShapeStatic.ZeroBased TypeNum.U2) Double
example =
   let a = atom FL.i0
       b = atom FL.i1
       distr =
          Distr.DiscreteTrained $ Map.fromList $
          ('a', ShapeStatic.vector $ 1!:2!:FL.end) :
          ('b', ShapeStatic.vector $ 4!:3!:FL.end) :
          ('c', ShapeStatic.vector $ 0!:1!:FL.end) :
          []
   in finish (ShapeStatic.ZeroBased Proxy) distr $
      replicate 5 $ replicate 10 a <> replicate 20 b

Documentation

data T sh prob Source #

Instances
(Indexed sh, Eq sh, Real prob) => Semigroup (T sh prob) Source # 
Instance details

Defined in Math.HiddenMarkovModel.Pattern

Methods

(<>) :: T sh prob -> T sh prob -> T sh prob #

sconcat :: NonEmpty (T sh prob) -> T sh prob #

stimes :: Integral b => b -> T sh prob -> T sh prob #

atom :: (Indexed sh, Index sh ~ state, Real prob) => state -> T sh prob Source #

append :: (Indexed sh, Eq sh, Real prob) => T sh prob -> T sh prob -> T sh prob infixl 5 Source #

replicate :: (Indexed sh, Real prob) => Int -> T sh prob -> T sh prob Source #

finish :: (Indexed sh, Real prob) => sh -> tdistr -> T sh prob -> Trained tdistr sh prob Source #