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

Safe HaskellNone

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) 

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

append :: (Indexed sh, Eq sh, Real prob) => T sh prob -> T sh prob -> T sh probSource

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

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