HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulemarkov-chain-usage-model-0.0.0Haskell2010

MarkovChain

  • 2 types
  • 16 values
value(.*) :: M -> M -> M
#
value(./) :: M -> M -> M
#
value(.-) :: M -> M -> M
#
valuefundamental
  1. :: M

    Reduced matrix (n x n).

  2. -> M

    n x n

#

The fundamental matrix for absorbing chains. Its (i, j)-th entry is the expected number of occurrences of state j prior to absorption at the sink, given that one starts in state i. So the first row indicates the expected occurence of each state starting from the start state.

Example1 expression
fundamental (minorMatrix 5 5 p :: M)┌                                                                                 ┐│                 1.0  1.2307692307692306  1.2307692307692308  0.9230769230769231 ││                 0.0  1.2307692307692306  1.2307692307692308  0.9230769230769231 ││                 0.0 0.15384615384615385  2.1538461538461537  0.6153846153846154 ││                 0.0  0.3076923076923077  0.3076923076923077  1.2307692307692308 │└                                                                                 ┘
valueoccVariance
  1. :: M

    Reduced matrix (n x n).

  2. -> M
#

Expected variance of the occurrence for each state. The (i, j)-th entry should be read in the same away as that of the fundamental matrix above.

Example1 expression
occVariance (fundamental (minorMatrix 5 5 p :: M))┌                                                                                 ┐│                 0.0 0.28402366863905315  2.5562130177514795  0.4970414201183433 ││                 0.0 0.28402366863905315  2.5562130177514795  0.4970414201183433 ││                 0.0 0.20118343195266267  2.4852071005917153  0.5207100591715977 ││                 0.0  0.3550295857988165  0.9230769230769231  0.2840236686390534 │└                                                                                 ┘
valueperron
  1. :: M

    Transition matrix (n x n).

  2. -> V
#

The Perron eigenvector (long-run occupancies/probabilities of states).

Example1 expression
perron p[0.1857142857142857,0.22857142857142854,0.22857142857142856,0.17142857142857143,0.1857142857142857]
valuesigma
  1. :: M

    Stimulus matrix (n-1 x n).

  2. -> V

    Perron eigenvector.

  3. -> V
#

Compute the stimulus long-run occupancy.

Example1 expression
:{let s :: M   s = fromList 4 5     [ 1,    0,    0,    0,    0     , 0,    0.5,  0.5,  0,    0     , 0,    0.5,  0.25, 0.25, 0     , 0.25, 0,    0,    0.5,  0.25     ]in sigma s (perron p):}[0.2807017543859649,0.2807017543859649,0.21052631578947367,0.17543859649122806,5.2631578947368425e-2]
valuenodeProbabilities
  1. :: M

    Transition matrix (n x n).

  2. -> M
#

Compute the probability of occurrence for each state.

Example1 expression
getRow 1 (nodeProbabilities p)[1.0,1.0,0.5714285714285715,0.75]
valueexpectedLength
  1. :: M

    Fundamental matrix (n x n).

  2. -> Double
#

Expected test case length.

Example1 expression
expectedLength (fundamental (minorMatrix 5 5 p :: M))4.384615384615385
valueexpectedArcReliability
  1. :: Maybe (M, M)
  2. -> (M, M)
  3. -> (M, M)

    (mean, variance)

#

Success rate matrix.

Example2 expressions
expectedArcReliability Nothing (fromList 2 2 [10,10,10,10], fromList 2 2 [0,1,2,3])(┌                                       ┐│ 0.9166666666666666 0.8461538461538461 ││ 0.7857142857142857 0.7333333333333333 │└                                       ┘,┌                                             ┐│  5.876068376068376e-3  9.298393913778529e-3 ││ 1.1224489795918367e-2 1.2222222222222223e-2 │└                                             ┘):{ expectedArcReliability   (Just (fromList 2 2 [10,10,10,10], fromList 2 2 [1,1,1,1]))   (fromList 2 2 [10,10,10,10], fromList 2 2 [0,1,2,3]):}(┌                                       ┐│ 0.9130434782608695              0.875 ││               0.84 0.8076923076923077 │└                                       ┘,┌                                             ┐│ 3.3081285444234404e-3              4.375e-3 ││  5.169230769230769e-3  5.752794214332676e-3 │└                                             ┘)
valuetransientReliability
  1. :: M

    Reduced transition matrix (n-1 x n).

  2. -> Maybe (M, M)

    Prior successes and failures (n-1 x n).

  3. -> (M, M)

    Observed successes and failures (n-1 x n).

  4. -> (M, M)

    Reliability vector and reliability variance vector.

#
valuekullbackLeibler
  1. :: M

    Transitions (n x n).

  2. -> M

    Stimulis (m x n).

  3. -> V

    State visitations (n).

  4. -> M

    Stimulus execution (m x n).

  5. -> Double

    Discrimination.

#

Kullback-Leibler matrix discrimination.

Example1 expression
:{let s = fromList 4 5       [ 1,    0,   0,    0,    0       , 0,    0.5, 0.5,  0,    0       , 0,    0.5, 0.25, 0.25, 0       , 0.25, 0,   0,    0.5,  0.25       ] es = Vector.fromList [4, 5, 7, 3, 4] et = fromList 4 5   [ 4, 0, 0, 0, 0   , 0, 3, 2, 0, 0   , 0, 4, 1, 2, 0   , 1, 0, 0, 1, 1   ]in kullbackLeibler p s es et:}3.440540391434413e-2