Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data State
- type StateSet = Enumeration State
- stateSet :: StateSet
- data Coordinate
- type CoordinateSet = Enumeration Coordinate
- coordinateSet :: CoordinateSet
- type HMM = Gaussian CoordinateSet StateSet Double
- hmm :: HMM
- stateVector :: Double -> Double -> Double -> Double -> Vector StateSet Double
- circleLabeled :: T [] (State, Vector CoordinateSet Double)
- circle :: T [] (Vector CoordinateSet Double)
- revealed :: T [] State
- reconstructDistribution :: Gaussian CoordinateSet () Double
- reconstructModel :: HMM
- hmmTrainedSupervised :: HMM
- hmmTrainedUnsupervised :: HMM
- hmmIterativelyTrained :: HMM
Documentation
>>>
import qualified Math.HiddenMarkovModel as HMM
>>>
import qualified Data.NonEmpty as NonEmpty
>>>
import Data.Eq.HT (equating)
>>>
>>>
checkTraining :: (Int, HMM) -> Bool
>>>
checkTraining (maxDiff,hmm_) =
>>>
maxDiff >=
>>>
(length $ filter id $ NonEmpty.flatten $
>>>
NonEmpty.zipWith (/=)
>>>
(HMM.reveal hmm_ circle) (fmap fst circleLabeled))
type StateSet = Enumeration State Source #
data Coordinate Source #
Instances
type CoordinateSet = Enumeration Coordinate Source #
circleLabeled :: T [] (State, Vector CoordinateSet Double) Source #
revealed :: T [] State Source #
>>>
take 20 $ NonEmpty.flatten revealed
[Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q3,Q3,Q3,Q4,Q4,Q4,Q1,Q1,Q1,Q2,Q2,Q2,Q3]
equating (take 1000 . NonEmpty.flatten) revealed $ fmap fst circleLabeled
reconstructDistribution :: Gaussian CoordinateSet () Double Source #
Sample multivariate normal distribution and reconstruct it from the samples. You should obtain the same parameters.
reconstructModel :: HMM Source #
Generate labeled emission sequences and use them for supervised training.
checkTraining (0, reconstructModel)
hmmTrainedSupervised :: HMM Source #
checkTraining (0, hmmTrainedSupervised)
hmmTrainedUnsupervised :: HMM Source #
checkTraining (0, hmmTrainedUnsupervised)
hmmIterativelyTrained :: HMM Source #
checkTraining (40, hmmIterativelyTrained)