prob140.MarkovChain.from_table¶
-
classmethod
MarkovChain.
from_table
(table)[source]¶ Constructs a Markov Chain from a Table
Parameters: - table : Table
A table with three columns for source state, target state, and probability.
Returns: - MarkovChain
Examples
>>> table = Table().states(make_array('A', 'B')) ... .transition_probability(make_array(0.5, 0.5, 0.3, 0.7)) >>> table Source | Target | Probability A | A | 0.5 A | B | 0.5 B | A | 0.3 B | B | 0.7 >>> MarkovChain.from_table(table) A B A 0.5 0.5 B 0.3 0.7