JSL icon indicating copy to clipboard operation
JSL copied to clipboard

viterbi is broken?

Open murphyk opened this issue 2 years ago • 4 comments

Old figure Screen Shot 2022-05-13 at 8 48 07 AM new one is different

https://github.com/probml/JSL/blob/main/jsl/demos/hmm_casino.py

murphyk avatar May 13 '22 15:05 murphyk

The current version of the code gives the attached result, which seems wrong. (I feel like we fixed this issue in the past, and we are repeating ourselves here... Badly need unit tests!!!)

Screen Shot 2022-05-13 at 12 42 11 PM .

murphyk avatar May 13 '22 19:05 murphyk

I could help writing the unit tests, if needed.

maheswarantp avatar May 18 '22 17:05 maheswarantp

I think our previous code(GSoC code before being added to distrax) discarded the backward step of Viterbi. Hence, it was not correct. Also, the difference between plots came from the fact that we were using distax.HMM for the hmm_casino demo rather than our previous lib. So, if there was a bug, it should have been of distrax.HMM. So, I run this demo using hmmlearn and it produced the figure below(which is the same). So, distrax.HMM does not have any bug. Also, I changed this demo in a way that it is using hmm_lib now and added unit tests which compare tfd.HMM with our HMM model. image

karalleyna avatar May 18 '22 22:05 karalleyna

@karalleyna , where was the bug? Also please convert https://github.com/probml/JSL/blob/main/jsl/hmm/hmm_lib_test.py to use pytest.

murphyk avatar May 19 '22 00:05 murphyk