[Math] Figuring out probabilities with Hidden Markov Models

algorithmsbayesian networkmarkov chainsprobabilitystochastic-processes

I'm really new to Math so sorry in advance if this question does not make sense. Also I cross posted this on stats.stackexchange.com also.

Background:

I'm trying to learn about hidden Markov models and they seem interesting but I was wondering about the probabilities they use to generate their predictions. Most of the information I have read has probabilities already about changing states and staying in the current state.

I was on Github and looked up code(mainly python code) to understand a bit better but either they have the probabilities already computed or are calculating it based on occurrences in other documents(in the case of a spell checker, it studied a book to understand the words occurrences as well as the probability of them being beside each other).

Problem:

But I'm trying to understand the theory of figuring out probabilities for the HMM when I'm not using speech or text recognition. I'm trying to make a game which is trying to guess numbers based on a users behaviour(i.e. user is given a list of fruit prices and picks a basket of various fruits. We know the individual fruit prices and the users only reports the total cost of their basket, we then try to find the quantities of fruit they choose. They are not adversarial and cannot change their total quantities by more than 5%). My approach was to first find all the possibilities for all days, then using a graph to create edges between nodes that were within 5% and remove all improbable nodes. Now I have a range and with every turn new paths are being created and impossible ones are being removed. So within that range I am trying have a program 'zero' in on the correct solution.

I think the HMM model would be helpful for this but I'm a bit confused on the application of Baum–Welch or forward-backward algorithm to create probabilities(that I can feed into my implementation of hmm).

If it helps, I originally posted this at stackexchange (alot of details about the game itself as well code I have) . I got a very good solution, to find the nodes with the highest amount of edges as solutions. Its okay but it doesn't select a solution and if it makes a mistake it simply continues the path. I was also advised from mathexchange that this can be solved as a hidden markov model. I am basically struggling with applying it to my problem(right now figuring out the probability part. I have been told to create all paths as equally probable but I don't understand how that helps a HMM pick the most probable solution).

If anyone has any suggestions or suggested reading or sample code(I'm learning python, but I can try to understand any other code thats provided). If possible can it be explained to a layman(I think I can apply the code if I can clearly understand the theory, which apparently I do not).

Thanks in advance and sorry again if this question does not apply or is not explained correctly.

Best Answer

One could do worse than to begin with What is a hidden Markov model? by Sean R Eddy. And these pages on Baum-Welch and Viterbi algorithms contain some links to the literature you might try.

Related Question