prob140.MarkovChain.plot_path¶
-
MarkovChain.
plot_path
(starting_condition, path)[source]¶ Plots a Markov Chain’s path.
Parameters: - starting_condition : state
State to start at.
- path : iterable
List of valid states.
Examples
>>> states = ['A', 'B'] # Works with all state data types! >>> transition_matrix = np.array([[0.1, 0.9], ... [0.8, 0.2]]) >>> mc = MarkovChain.from_matrix(states, transition_matrix) >>> mc.plot_path(mc.simulate_path('B', 20)) <Plot of a Markov Chain that starts at 'B' and takes 20 steps>