|
|
Line 1: |
Line 1: |
| {{Distinguish|Forward-backward algorithm}}
| | 41 year-old Authors Danilo from Kirkland, has interests for instance football, property developers in [http://www.xertionfitness.com/timotmarble/activity/82449/ singapore property website] and tool collecting. Gets encouragement through travel and just spent 4 weeks at Pearling. |
| | |
| The '''forward algorithm''', in the context of a [[hidden Markov model]], is used to calculate a 'belief state': the probability of a state at a certain time, given the history of evidence. The process is also known as ''filtering''. The forward algorithm is closely related to, but distinct from, the [[Viterbi algorithm]].
| |
| | |
| For an HMM such as this one:
| |
| [[Image:hmm temporal bayesian net.svg|600px|center|Temporal evolution of a hidden Markov model]]
| |
| this probability is written as <math>P(x_t | y_{1:t} )</math>. (abbreviating <math>x(t)</math> as <math>x_t</math>.) A belief state can be calculated at each time step, but doing this does not, in a strict sense, produce the most likely state ''sequence'', but rather the most likely state at each time step, given the previous history.
| |
| | |
| ==Algorithm==
| |
| | |
| The goal of the forward algorithm is to compute the [[Joint probability distribution|joint probability]] <math>p(x_t,y_{1:t})</math>, where for notational convenience we have abbreviated <math>x(t)</math> as <math>x_t</math> and <math>(y(1), y(2), ..., y(t))</math> as <math>y_{1:t}</math>. Computing <math>p(x_t,y_{1:t})</math> directly would require [[Marginal distribution|marginalizing]] over all possible state sequences <math>\{x_{1:t-1}\}</math>, the number of which grows exponentially with <math>t</math>. Instead, the forward algorithm takes advantage of the [[conditional independence]] rules of the [[hidden Markov model]] (HMM) to perform the calculation recursively.
| |
| | |
| To demonstrate the recursion, let
| |
| | |
| ::<math>\alpha_t(x_t) = p(x_t,y_{1:t}) = \sum_{x_{t-1}}p(x_t,x_{t-1},y_{1:t})</math>.
| |
| | |
| Using the [[Chain rule (probability)|chain rule]] to expand <math>p(x_t,x_{t-1},y_{1:t})</math>, we can then write
| |
| | |
| ::<math>\alpha_t(x_t) = \sum_{x_{t-1}}p(y_t|x_t,x_{t-1},y_{1:t-1})p(x_t|x_{t-1},y_{1:t-1})p(x_{t-1},y_{1:t-1})</math>.
| |
| | |
| Because <math>y_t</math> is conditionally independent of everything but <math>x_t</math>, and <math>x_t</math> is conditionally independent of everything but <math>x_{t-1}</math>, this simplifies to
| |
| | |
| ::<math>\alpha_t(x_t) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\alpha_{t-1}(x_{t-1})</math>.
| |
| | |
| Thus, since <math>p(y_t|x_t)</math> and <math>p(x_t|x_{t-1})</math> are given by the model's [[Hidden Markov model#Architecture|emission distributions]] and [[Hidden Markov model#Architecture|transition probabilities]], one can quickly calculate <math>\alpha_t(x_t)</math> from <math>\alpha_{t-1}(x_{t-1})</math> and avoid incurring exponential computation time.
| |
| | |
| The forward algorithm is easily modified to account for observations from variants of the hidden Markov model as well, such as the [[Markov jump linear system]].
| |
| | |
| ==Smoothing==
| |
| In order to take into account future history (i.e., if one wanted to improve the estimate for past times), you can run the Backward algorithm, a complement of the Forward. This is called ''smoothing''. Mathematically, it would be said that the [[forward/backward algorithm]] computes <math>P(x_k | y_{1:t} )</math> for <math>1<k<t</math>. So the use of the full F/B algorithm takes into account all evidence.
| |
| | |
| ==Decoding==
| |
| In order to achieve the most likely sequence, the [[Viterbi algorithm]] is required. It computes the most likely state sequence given the history of observations, that is, the state sequence that maximizes <math>P(x_{0:t}|y_{0:t})</math>.
| |
| | |
| The difference between the state sequence that the [[Viterbi algorithm]] estimate generates and the state sequence that the Forward algorithm generates is that the [[Viterbi algorithm]] recalculates the entire sequence with each new data point whereas the Forward Algorithm only appends the new current value to the previous sequence computed.
| |
| | |
| == See also ==
| |
| * [[Viterbi algorithm]]
| |
| * [[Forward-backward algorithm]]
| |
| | |
| == Further reading ==
| |
| * Russel and Norvig's ''Artificial Intelligence, a Modern Approach'', starting on page 541 of the 2003 edition, provides a succinct exposition of this and related topics
| |
| | |
| [[Category:Markov models]]
| |
| | |
| | |
| {{algorithm-stub}}
| |
41 year-old Authors Danilo from Kirkland, has interests for instance football, property developers in singapore property website and tool collecting. Gets encouragement through travel and just spent 4 weeks at Pearling.