4

2

I am new to Markov chains and HMM and I am looking for help in developing a program (in python) that predicts the next state based on 20 previous states (lets say 20 states in last 20 months). I have a sequential dataset with 50 customers i.e. the rows contain sequence of 20 states for each of the 50 customers (dataset has 50 rows and 20 columns excluding the headers). I am trying to determine the next state using markov chains and all the literature in the web is focused around examples of text strings. I am looking something specific to the kind of example I have. Can somebody please help me come up with the initial probability matrix and then consider the 20 states to predict the next state?

thanks for the reply. I was planning to go with hmm because my assumption was that the observed sequence was due to some hidden phenomenon (say customer behavior for example). can I justify using simple markov chains in that case? for the simple markov chains that you mentioned: can you help me with the code to build the transition matrix and then run it across all the observed states please? – mlgal55 – 2018-03-28T17:07:19.877

no u can't. Only transition matrix ( from Markov Chain) will have transition from one known state to another. – Arpit Sisodia – 2018-06-15T15:01:46.690