simulate
Builtin index · Statistics & ML
result = chain.simulate(n_steps, [seed=])
Input: n_steps, seed · Output: result
What it is
Draws one random trajectory from a markov_chain chain, starting at its initial_state, for an integer n_steps transitions (with an optional integer seed=).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = chain.simulate(n_steps, [seed=]) | n_steps —not documented yetseed optionalnot documented yet | result vector | Returns a length-n_steps + 1 vector of integer state indices. |
Examples
No documentation example calls this form yet. The Statistics & ML chapter is where one belongs.
How it works
simulate(chain, n_steps, [seed=]) — callable as chain.simulate(n_steps). The one markov_chain operation that needs its own verb rather than reusing predict/ score (there's no input X to predict from or score against) — draws a length-n_steps+1 random walk over states starting at chain.initial_state, sampling each transition from the current state's row of chain.transition via inverse-CDF. See markov_simulate's own doc comment.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.