| Copyright | (c) Henning Thielemann 2007 |
|---|---|
| Maintainer | haskell@henning-thielemann.de |
| Stability | stable |
| Portability | Haskell 98 |
| Safe Haskell | Safe |
| Language | Haskell98 |
Data.MarkovChain
Description
Markov chains can be used to recompose a list of elements respecting the fact that the probability of a certain element depends on preceding elements in the list.
Documentation
Arguments
| :: (Ord a, RandomGen g) | |
| => Int | size of prediction context |
| -> [a] | training sequence, the one to walk through randomly |
| -> Int | index to start the random walk within the training sequence |
| -> g | random generator state |
| -> [a] |
Creates a chain of elements respecting to the probabilities of possible successors. The list is considered being cyclic in order to have successors for the last elements.
Example:
take 100 $ run 2 "The sad cat sat on the mat. " 0 (Random.mkStdGen 123)