Python implementation for the supporting algorithms from the book Markov Chains: From Theory to Implementation and Experimentation by Paul A. Gagniuc
The book contains 17 supporting algorithms in 3 languages Visual Basic, PHP and Javascript:
- The algorithm simulates a sequence of draws from 2 jars with black and white balls. The ball drawn indicates the color of the jar used for the next draw;
- The algorithm extends the previous one with a function that builds the jars with different ball ratios;
- The algorithm extracts transition probabilities from a sequence of events;
- The algorithm generates predictions from transition probabilities;
- The algorithm generates predictions until a steady state is detected;
- The algorithm calculates the steady state using a closed-form equation;
- The algorithm combines the extraction of probabilities with the generation of predictions;
- The algorithm extends the previous one to work with 3-state chains;
- The algorithm extends the previous one to work with 4-state chains;
- The algorithm is presented in the book with improvements to allow more states dynamically;
- The algorithm converts integer values into discrete bands;
- The algorithm extends the 3-state version with an absorbing state;
- The algorithm presents the 4-state version as a configurable n-state version;
- The algorithm builds a 3-state machine with jars from given ball ratios;
- The algorithm extends the previous one with a 4-state machine;
- The algorithm calculates probabilities to validate previous version;
- The algorithm uses a 4-state machine to calculate the average time spent in each state;