Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Off-by-1-error in backtracking? #1

Open
Sciss opened this issue Aug 27, 2018 · 1 comment
Open

Off-by-1-error in backtracking? #1

Sciss opened this issue Aug 27, 2018 · 1 comment

Comments

@Sciss
Copy link

Sciss commented Aug 27, 2018

Looking at

https://github.com/daoliker/viterbi/blob/master/viterbi_decoder.cc#L35

shouldn't that be

hid_seq[t] = psi[t + 1][hid_seq[t + 1]];

it seems off-by-one for my glance; especially note that this way hid_seq[0] will always be zero which I think is not intended.

@Mary62442
Copy link

Hi @Sciss,
I have noticed the same thing.
The Backtracking equation states that you should search in the psi array at position t+1 and not position t.
I have written the Viterbi algorithm in JavaScript and was trying to make a litmus test by checking what other developers have written. A valid implementation in python is here: https://people.eng.unimelb.edu.au/tcohn/comp90042/HMM.py
I was about to open an issue as well, but you beat me to it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants