Skip to content

Viterbi algorithm bug fix: consider states that lead *to* the current state, not reachable *from* it - #3

Merged
1 commit merged into
biopython:masterfrom
wgillett:master
Feb 14, 2011
Merged

1 commit merged into
biopython:masterfrom
wgillett:master

Conversation

@wgillett

Copy link
Copy Markdown

Bug fix related to bug #2947. Please review and commit if it's OK. Thanks,
Walter Gillett

… recursive calculation of path probabilities, we need to loop over previous states that have transitions *to* the current state, not states that are reachable *from* the current state. This bug only shows up for non-ergodic models, that is, models where some transitions are not allowed. In an ergodic model, any state is reachable from any other state, so the set of "from" states for a given state is always the same as the set of "to" states; both are equal to the full state alphabet. See the discussion in bug biopython#2947.

In support of this bug fix, extend the HiddenMarkovModel to create a dictionary of states with transitions to a given state ("to" transitions) in addition to the existing dictionary of states that are reachable from a given state ("from" transitions). Add unit tests for non-ergodic models, for "to" transitions, and improve the existing "from" transition test to make it more robust. Also remove some unnecessary and inefficient exception throwing.
@chapmanb

Copy link
Copy Markdown
Member

Walter;
Thanks for the continued improvements to the HMM code. Let us know if you find any other problems,
Brad

@wgillett

Copy link
Copy Markdown
Author

Brad - thanks for the code review, will do-
Walter

This pull request was closed.
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

Successfully merging this pull request may close these issues.

3 participants