markov {transition}+ | [Macro] |
Creates a Markov item stream. Each transition is a rule in the form:
({past}* -> {{outcome} | ({outcome} {weight})}+The left side of the rule (the values preceding ->) declare the ordered past outcomes that trigger the rule. Values closer to the -> are more recent choices. The number of left-side values determines the Markov order of the pattern; any number of values may be specified but every transition rule should have the same number of values. Values to the right of the -> define the set of outcomes. By default each outcome has the same probability of being selected; to weight an outcome differently, specify it in a list together with its weight. For example,
(c -> a (b 2) c)defines a 1st order Markov transition rule whose outcomes A, B and C are triggered if C was the last value generated; B has twice the probability of being selected as A or C.
The next example
(q w a -> e r (d 3) g)describes a third-order transition rule, where A is the most recent outcome, and
(* x a -> foo bas zuz)demonstrates the "wildcard" * that matches any value in its position. The wildcard token allows multiple transitions with identical outcomes to be collapsed to a single rule. Finally,
(-> a (b .1) c)describes a 0th order Markov transition, equivalent to weighted random selection. Only one transition rule should be specified in a 0th order Markov pattern.
Example:
;;; ;;; first order Markov of Happy Birthday ;;; (markov (c4 -> (c4 0.4) (d4 0.3) (f4 0.1) (g4 0.1) (c5 0.1)) (d4 -> (c4 0.75) (f4 0.25)) (e4 -> (c4 0.667) (d4 0.333)) (f4 -> (e4 0.6) (c4 0.2) (f4 0.2)) (g4 -> (f4 1.0)) (a4 -> (f4 1.0)) (c5 -> (a4 1.0)))
See Also:
graph, markov-analyze