I'm experimenting with using Lea to analyze Markov chains. As an example, rules for rolling dice in certain games can be modelled as a Markov chain (a simplified example - roll 2 dice, rerolling doubles, is an absorbing chain where (n, m) is an absorbing state if n != m, and transitions to a new rolled pair if n == m).
One thing I'd like to do is extract the transition matrix from a
Chain object. I can do this using the private
_next_state_lea_per_state attribute, and deconstructing the
Alea object for each starting state - but that's a little messy, and uses private information.
Is there a better way that I've missed? And if not, could one be added?
(Actually, Lea in general seems to make it hard to extract the underlying representation of an object - the best way I've found of getting the probability values for an
Alea object is
list(zip(obj.support, obj.ps)) which is a little non-obvious (neither "support" nor "ps" are attribute names I would have immediately thought of).