1 / 6

Many paths give rise to the same sequence X

The Forward Algorithm. Many paths give rise to the same sequence X. We would often like to know the total probability of some sequence:. The problem is that the number of possible paths increases exponentially with the length of the sequence.

darryl
Download Presentation

Many paths give rise to the same sequence X

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Forward Algorithm Many paths give rise to the same sequence X We would often like to know the total probability of some sequence: Theproblem is that the number of possible paths increases exponentially with the length of the sequence # of possible paths = (number of underlying states)L Problems that grow exponentially with size can only be solved by brute force for remarkably small problem sizes We need a better way!! P(x) =

  2. The Forward Algorithm Defining the forward variable “The forward variable for state k at position i” fk(i) = P(x1…xi , pi = k) “the probability of the sequence from the beginning to the symbol at position i, requiring that the path at position i is k” How does this help?

  3. The Forward Algorithm What if we had in our possession all of the forward variables for L, the last position of the sequence? That would be pretty awesome, since to get the overall probability of the sequence, we would need only sum the forward variables for each state (after correcting for the probability of the final transition to the end state) P(X) = Gee, that’s great. But I don’t yet have those “final position” forward variables” in my possession, do I?

  4. The Forward Algorithm A recursive definition for forward variables fk(i) = P(x1…xi , pi = k) We can recursively define forward variables in terms of their own values at prior positions in the sequence… We’ll examine in more detail later but the termination condition is satisfied by virtue of the fact that sequences are finite and so we must eventually come to the beginning.. fl(i+1) = el(xi+1)

  5. The Forward Algorithm Putting it all together • Initialization: • fstart(0) = 1 • fk(0) = 0 for all initial states k Recursion (i = 1 … L): fl(i) = el(xi) Termination: P(X) = How to express these equations in Python?

  6. The Forward Algorithm Reduction to Python code The forward variables are conveniently kept in a table, with indices that are state in one dimension and sequence positions in another: forward = [{}] # a list of dicts forward[0]["S"] = log_float(1) forward[position][new_state_l] = \ sum_over_states* emission_prob Here’s how one of the initialization conditions might be set: Later on you might have something like: Try and implement this, we’ll look carefully at how it works next time

More Related