# set initial state probabilities for hmm #302

Closed
opened this Issue Dec 29, 2014 · 6 comments

Projects
None yet
1 participant
Member

### rcurtin commented Dec 29, 2014

 Reported by fleischhauf on 30 Jun 44034781 05:14 UTC I did not see an option for that anywhere, i guess its assumed to be uniform ?

Closed

Open

Member

### rcurtin commented Dec 30, 2014

 Commented by rcurtin on 8 Jan 44034970 20:38 UTC Hi Nik, Use this constructor which takes a transition matrix as a parameter. Alternately, you can call HMM::Transition() to modify the transition matrix before calling HMM::Train(). But yes, if you don't specify an initial transition matrix, the transition probabilities will all be uniform. Feel free to reopen the ticket if you have any problems with those ideas.
Member

### rcurtin commented Dec 30, 2014

 Commented by fleischhauf on 30 Apr 44035068 08:45 UTC Hey Ryan, thats not what I meant, usually an hidden markov model is parameterized by: Transition matrix A, Observation probabilities B, initial state probabilities \pi. like described in here:[here: [http://people.sabanciuniv.edu/~berrin/cs512/reading/rabiner-tutorial-on-hmm.pdf](http://courses.media.mit.edu/2010fall/mas622j/ProblemSets/ps4/tutorial.pdf] or) or are the initial state probabilities somehow part of the transition matrix in the constructor ?
Member

### rcurtin commented Dec 30, 2014

 Commented by rcurtin on 17 Apr 44037669 04:42 UTC Ok, I understand what you mean now. Here is a comment in the source that I found: // Starting state (at t = -1) is assumed to be state 0. This is what MATLAB // does in their hmmdecode() function, so we will emulate that behavior. So mlpack just assumes that the initial state is always state 0. It should not be hard to put actual initial state probabilities into the code. I may be able to find time to do that in the next few days, but I'm pretty busy right now. These functions will need to be modified: HMM::Predict() HMM::Train() HMM::Forward() as well as the HMM class itself (it'll need to hold initial state probabilities), and a test to make sure that it works with the initial state probabilities properly.
Member

### rcurtin commented Dec 30, 2014

 Commented by Tim.Butler on 5 Aug 44404935 14:30 UTC I would like to be able to implement an HMM by initializing the model with an initial distribution as stated above. I was searching for an initial distribution tutorial/implementation and I came across this ticket. I realize that mlpack 1.0.9 has not been released yet, but I was curious of the status of this ticket so I may use the fixed source if initial distribution patches have been completed. Thanks.
Member

### rcurtin commented Dec 30, 2014

 Commented by rcurtin on 10 Sep 44404948 18:53 UTC Hi Tim, Currently there's no fix yet. I have a paper deadline coming up and won't be able to do this until at least June 6th (and maybe it will be a few weeks after that until I get to it), but I will ensure it is done before 1.0.9 is released. I'll see if I can find anyone interested to work on it... Thanks, Ryan
Member

### rcurtin commented Dec 30, 2014

 Commented by rcurtin on 24 Jul 44519823 00:27 UTC Okay, I finally got around to fixing this, in r16789 and r16790. It will be a part of the next release, but if you need it now, you can compile mlpack from svn trunk. Initial probabilities can be specified with an HMM constructor or manually through the HMM::Initial() function. The forward/backward algorithms, Baum-Welch algorithms, and Viterbi algorithms take the initial probabilities into account now, so everything should work as expected. Sorry that this whole thing took so long. Maybe my time estimation algorithms are faulty...