The definition may be wrong, so please correct me if that is so.. I need to generate a Markov model from a matrix of a following kind:
four two "e"
four two "e"
three three "e"
one three "e"
zero six one zero "e"
two two "e"
two two "e"
two two "e"
two two "e"
two two "e"
four zero "e"
two two "e"
three one three "e"
three "e"
four one "e"
three one "e"
two one one zero two "e"
two five "e"
three four two "e"
zero five "e"
three "e"
three three "e"
three "e"
one one "e"
three two "e"
one one "e"
three two zero zero zero "e"
three three "e"
three one "e"
three two "e"
I need the output to be something like: {"four":[{2:"two", 3:"one",2:"exit"},{...}],"three":[{...}]}
The numbers above are basically how many times does the transition to a particular state happens..
I am using python for this.
Answer to the usual question "what have you tried?": "I tried a couple for approaches but they did not quite deliver, so I hope one of the answers will help clarifying things a bit".
Thanks a lot.
EDIT, updated to show the full matrix.