misc icon indicating copy to clipboard operation
misc copied to clipboard

Doubt in Viterbi implementation

Open tarunrkk opened this issue 8 years ago • 1 comments

Hi,

I am confused wrt lines 26 and 27 of the viterbi implementation: trellis[:, t] = (trellis[:, t-1, None].dot(self.Obs(obs[t]).T) * self.transProb).max(0) backpt[:, t] = (np.tile(trellis[:, t-1, None], [1, self.N]) * self.transProb).argmax(0)

I am not able to understand why there is no dot product happening in the second line. Why multiply only with transProb without taking obs into account?

Please help.

tarunrkk avatar Apr 24 '17 01:04 tarunrkk

@tarunrkk: backpt is the backtrace to keep track the maximum decoding path. At timestep t, the backpt array keeps track of the best path so far up to timestep t-1. The observation probabilities obs at time t is taken into account in trellis at timestep t, which is taken into account in backpt at timestep t+1. If it is still confusing, here is the algorithm for your reference: https://phvuresearch.files.wordpress.com/2013/12/viterbi_algo.png?w=1024&h=704

phvu avatar Apr 25 '17 20:04 phvu