Viterbi algorithm: Difference between revisions

Content deleted Content added
"Spelling. This is a semi-automatic update (software suggests changes and user decides). It is likely this bot did not fix all spelling mistakes in this article."
Line 10:
 
{{HMM example}}
 
You talk to your friend three days in a row and discover that on the first day he went for a walk, on the second day he went shopping, and on the third day he cleaned his apartment. You have two questions: What is the overall probability of this sequence of observations? And what is the most likely sequence of rainy/sunny days that would explain these observations? The first question is answered by the forward algorithm; the second by the Viterbi algorithm. These two algorithm are structurally so similar (in fact, they are both instances of the same abstract algorithm) that they can be implemented in a single function:
 
def forward_viterbi(y, X, sp, tp, ep):
T = {}
for state in X: