Reputation: 23
Is it possible to predict next digit in a sequence using an hmm? For example I have the dataset as follows: [0, 3, 4, 1] [1, 3, 4, 2] etc.
After training my model with the data described above I want to be able to predict the next digit for every number that I get as input. i.e if 0 is the input I want to know how possible it is to get 1 or 2 or 3... after that. Also I don't know the transition matrix and the probabilities of each next state from the start. I guess I have to compute them too.
Upvotes: 0
Views: 518
Reputation: 120
HMMs are good at predicting the labels (hidden states) of a fully observed sequence, not for completing a sequence. A better alternative may be to train a classifier or regression model on windows of observations, then use that for prediction.
If you still want to use an hmm for this problem, you will need to estimate the transition matrix and the emission probabilities from your data. You can do this using an algorithm called Baum-Welch, which is implemented in some libraries like hmmlearn. Once you have trained your hmm on your data, you can use it to predict the next digit by computing the conditional probability of each possible digit given the previous ones. This can be done using an algorithm called Forward-Backward, which is also implemented in some libraries like hmmlearn.
Upvotes: 0