https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Forward_algorithm Forward algorithm - Revision history 2025-05-25T06:32:51Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.2 https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1291980416&oldid=prev BjornChunt: /* Complexity */ edited for correctness and clarity 2025-05-24T14:43:11Z <p><span class="autocomment">Complexity: </span> edited for correctness and clarity</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 14:43, 24 May 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 83:</td> <td colspan="2" class="diff-lineno">Line 83:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Complexity==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Complexity==</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Complexity of Forward Algorithm is &lt;math&gt;\Theta(nm^2)&lt;/math&gt;, where &lt;math&gt;m&lt;/math&gt; is the number of <del style="font-weight: bold; text-decoration: none;">hidden</del> <del style="font-weight: bold; text-decoration: none;">or</del> latent <del style="font-weight: bold; text-decoration: none;">variables,</del> like weather in the example above, and &lt;math&gt;n&lt;/math&gt; is the length<del style="font-weight: bold; text-decoration: none;"> of the sequence</del> of the observed <del style="font-weight: bold; text-decoration: none;">variable</del>. This is clear reduction from the <del style="font-weight: bold; text-decoration: none;">adhoc</del> method of exploring all the possible states <del style="font-weight: bold; text-decoration: none;">with</del> a complexity of &lt;math&gt;\Theta(nm^n)&lt;/math&gt;.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Complexity of Forward Algorithm is &lt;math&gt;\Theta(nm^2)&lt;/math&gt;, where &lt;math&gt;m&lt;/math&gt; is the number of <ins style="font-weight: bold; text-decoration: none;">possible</ins> <ins style="font-weight: bold; text-decoration: none;">states for a</ins> latent <ins style="font-weight: bold; text-decoration: none;">variable</ins> <ins style="font-weight: bold; text-decoration: none;">(</ins>like<ins style="font-weight: bold; text-decoration: none;"> the number of</ins> weather<ins style="font-weight: bold; text-decoration: none;"> conditions</ins> in the example above<ins style="font-weight: bold; text-decoration: none;">)</ins>, and &lt;math&gt;n&lt;/math&gt; is the length of the observed <ins style="font-weight: bold; text-decoration: none;">sequence</ins>. This is<ins style="font-weight: bold; text-decoration: none;"> a</ins> clear reduction from the <ins style="font-weight: bold; text-decoration: none;">ad hoc</ins> method of exploring all the possible states<ins style="font-weight: bold; text-decoration: none;">, which</ins> <ins style="font-weight: bold; text-decoration: none;">has</ins> a complexity of &lt;math&gt;\Theta(nm^n)&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Variants of the algorithm==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Variants of the algorithm==</div></td> </tr> <!-- diff cache key enwiki:diff:1.41:old-1223156955:rev-1291980416:wikidiff2=table:1.14.1:ff290eae --> </table> BjornChunt https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1223156955&oldid=prev Kku: link speech recognition 2024-05-10T07:32:05Z <p>link speech recognition</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 07:32, 10 May 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 93:</td> <td colspan="2" class="diff-lineno">Line 93:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==History==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==History==</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The forward algorithm is one of the algorithms used to solve the decoding problem. Since the development of speech recognition&lt;ref name="speechRecognition"&gt;[[Lawrence Rabiner|Lawrence R. Rabiner]], "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition". ''Proceedings of the [[IEEE]]'', 77 (2), p.&amp;nbsp;257–286, February 1989. [https://dx.doi.org/10.1109/5.18626 10.1109/5.18626]&lt;/ref&gt; and pattern recognition and related fields like [[computational biology]] which use HMMs, the forward algorithm has gained popularity.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The forward algorithm is one of the algorithms used to solve the decoding problem. Since the development of <ins style="font-weight: bold; text-decoration: none;">[[</ins>speech recognition<ins style="font-weight: bold; text-decoration: none;">]]</ins>&lt;ref name="speechRecognition"&gt;[[Lawrence Rabiner|Lawrence R. Rabiner]], "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition". ''Proceedings of the [[IEEE]]'', 77 (2), p.&amp;nbsp;257–286, February 1989. [https://dx.doi.org/10.1109/5.18626 10.1109/5.18626]&lt;/ref&gt; and pattern recognition and related fields like [[computational biology]] which use HMMs, the forward algorithm has gained popularity.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Applications==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Applications==</div></td> </tr> </table> Kku https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220759945&oldid=prev Manoguru: /* Pseudocode */ reduction 2024-04-25T19:12:42Z <p><span class="autocomment">Pseudocode: </span> reduction</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:12, 25 April 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 74:</td> <td colspan="2" class="diff-lineno">Line 74:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#For &lt;math&gt;t = 1&lt;/math&gt; to &lt;math&gt;T&lt;/math&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#For &lt;math&gt;t = 1&lt;/math&gt; to &lt;math&gt;T&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#:&lt;math&gt;\alpha(x_t) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\alpha(x_{t-1})&lt;/math&gt;.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#:&lt;math&gt;\alpha(x_t) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\alpha(x_{t-1})&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#<del style="font-weight: bold; text-decoration: none;">Calculate</del> &lt;math&gt;<del style="font-weight: bold; text-decoration: none;">\beta_T </del>= \sum_{x_T} \alpha(x_T)<del style="font-weight: bold; text-decoration: none;"> </del>&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>#<ins style="font-weight: bold; text-decoration: none;">Return</ins> &lt;math&gt;<ins style="font-weight: bold; text-decoration: none;">p(x_T|y_{1:T})</ins>= <ins style="font-weight: bold; text-decoration: none;">\frac{\alpha(x_T)}{</ins>\sum_{x_T} \alpha(x_T)<ins style="font-weight: bold; text-decoration: none;">}</ins>&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#Return &lt;math&gt;p(x_T|y_{1:T})= \frac{\alpha(x_T)}{\beta_T}&lt;/math&gt;</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{frame-footer}}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{frame-footer}}</div></td> </tr> </table> Manoguru https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220759805&oldid=prev Manoguru: /* Algorithm */ correction regarding initial value; making it more similar to the article on Baum-Welch algorithm 2024-04-25T19:11:30Z <p><span class="autocomment">Algorithm: </span> correction regarding initial value; making it more similar to the article on Baum-Welch algorithm</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:11, 25 April 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 14:</td> <td colspan="2" class="diff-lineno">Line 14:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Algorithm==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Algorithm==</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The goal of the forward algorithm is to compute the [[Joint probability distribution|joint probability]] &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt;, where for notational convenience we have abbreviated &lt;math&gt;x(t)&lt;/math&gt; as &lt;math&gt;x_t&lt;/math&gt; and &lt;math&gt;(y(1), y(2), ..., y(t))&lt;/math&gt; as &lt;math&gt;y_{1:t}&lt;/math&gt;. Once the joint probability &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; is computed, the other probabilities &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; and &lt;math&gt;p(y_{1:t})&lt;/math&gt; are easily obtained. Both the state &lt;math&gt;x_t&lt;/math&gt; and observation &lt;math&gt;y_t&lt;/math&gt; are assumed to be discrete, finite random variables. The model's state transition probabilities &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt;<del style="font-weight: bold; text-decoration: none;"> and</del> observation/emission probabilities &lt;math&gt;p(y_t|x_t)&lt;/math&gt; are assumed to be known. Computing &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; <del style="font-weight: bold; text-decoration: none;">directly</del> would require [[Marginal distribution|marginalizing]] over all possible state sequences &lt;math&gt;\{x_{1:t-1}\}&lt;/math&gt;, the number of which grows exponentially with &lt;math&gt;t&lt;/math&gt;. Instead, the forward algorithm takes advantage of the [[conditional independence]] rules of the [[hidden Markov model]] (HMM) to perform the calculation recursively.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The goal of the forward algorithm is to compute the [[Joint probability distribution|joint probability]] &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt;, where for notational convenience we have abbreviated &lt;math&gt;x(t)&lt;/math&gt; as &lt;math&gt;x_t&lt;/math&gt; and &lt;math&gt;(y(1), y(2), ..., y(t))&lt;/math&gt; as &lt;math&gt;y_{1:t}&lt;/math&gt;. Once the joint probability &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; is computed, the other probabilities &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; and &lt;math&gt;p(y_{1:t})&lt;/math&gt; are easily obtained. </div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Both the state &lt;math&gt;x_t&lt;/math&gt; and observation &lt;math&gt;y_t&lt;/math&gt; are assumed to be discrete, finite random variables. The<ins style="font-weight: bold; text-decoration: none;"> hidden Markov</ins> model's state transition probabilities &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt;<ins style="font-weight: bold; text-decoration: none;">,</ins> observation/emission probabilities &lt;math&gt;p(y_t|x_t<ins style="font-weight: bold; text-decoration: none;">)&lt;/math&gt;, and initial prior probability &lt;math&gt;p(x_0</ins>)&lt;/math&gt; are assumed to be known. <ins style="font-weight: bold; text-decoration: none;">Furthermore, the sequence of observations &lt;math&gt;y_{1:t}&lt;/math&gt; are assumed to be given. </ins></div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Computing &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; <ins style="font-weight: bold; text-decoration: none;">naively</ins> would require [[Marginal distribution|marginalizing]] over all possible state sequences &lt;math&gt;\{x_{1:t-1}\}&lt;/math&gt;, the number of which grows exponentially with &lt;math&gt;t&lt;/math&gt;. Instead, the forward algorithm takes advantage of the [[conditional independence]] rules of the [[hidden Markov model]] (HMM) to perform the calculation recursively.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To demonstrate the recursion, let</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To demonstrate the recursion, let</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 36:</td> <td colspan="2" class="diff-lineno">Line 40:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>where &lt;math&gt;\mathbf{A} = [a_{ij}]&lt;/math&gt; is the transition probability matrix, &lt;math&gt;\mathbf{b}_t&lt;/math&gt; is the i-th row of the emission probability matrix &lt;math&gt;\mathbf{B} = [b_{ij}]&lt;/math&gt; which corresponds to the actual observation &lt;math&gt;y_t = i&lt;/math&gt; at time &lt;math&gt;t&lt;/math&gt;, and &lt;math&gt;\mathbf{\alpha}_t = [\alpha(x_t=1),\ldots, \alpha(x_t=n)]^T&lt;/math&gt; is the alpha vector. The &lt;math&gt;\odot&lt;/math&gt; is the [[Hadamard product (matrices)|hadamard product]] between the transpose of &lt;math&gt;\mathbf{b}_t&lt;/math&gt; and &lt;math&gt;\mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>where &lt;math&gt;\mathbf{A} = [a_{ij}]&lt;/math&gt; is the transition probability matrix, &lt;math&gt;\mathbf{b}_t&lt;/math&gt; is the i-th row of the emission probability matrix &lt;math&gt;\mathbf{B} = [b_{ij}]&lt;/math&gt; which corresponds to the actual observation &lt;math&gt;y_t = i&lt;/math&gt; at time &lt;math&gt;t&lt;/math&gt;, and &lt;math&gt;\mathbf{\alpha}_t = [\alpha(x_t=1),\ldots, \alpha(x_t=n)]^T&lt;/math&gt; is the alpha vector. The &lt;math&gt;\odot&lt;/math&gt; is the [[Hadamard product (matrices)|hadamard product]] between the transpose of &lt;math&gt;\mathbf{b}_t&lt;/math&gt; and &lt;math&gt;\mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The initial condition is set <del style="font-weight: bold; text-decoration: none;">as</del> <del style="font-weight: bold; text-decoration: none;">some</del> prior probability over &lt;math&gt;x_0&lt;/math&gt; as </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The initial condition is set <ins style="font-weight: bold; text-decoration: none;">in</ins> <ins style="font-weight: bold; text-decoration: none;">accordance to the</ins> prior probability over &lt;math&gt;x_0&lt;/math&gt; as </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\alpha(x_0) = p(x_0)<del style="font-weight: bold; text-decoration: none;">&lt;/math&gt; such that &lt;math&gt;\sum_{x_0} \alpha</del>(x_0)<del style="font-weight: bold; text-decoration: none;"> = 1.</del>&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\alpha(x_0) = p(<ins style="font-weight: bold; text-decoration: none;">y_0|</ins>x_0)<ins style="font-weight: bold; text-decoration: none;">p</ins>(x_0)&lt;/math&gt;<ins style="font-weight: bold; text-decoration: none;">.</ins></div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once the joint probability &lt;math&gt;\alpha(x_t) = p(x_t,y_{1:t})&lt;/math&gt; has been computed using the forward algorithm, we can easily obtain the related joint probability &lt;math&gt;p(y_{1:t})&lt;/math&gt; as</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once the joint probability &lt;math&gt;\alpha(x_t) = p(x_t,y_{1:t})&lt;/math&gt; has been computed using the forward algorithm, we can easily obtain the related joint probability &lt;math&gt;p(y_{1:t})&lt;/math&gt; as</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;<del style="font-weight: bold; text-decoration: none;">\beta_t = </del>p(y_{1:t}) = \sum_{x_t} p(x_t, y_{1:t}) = \sum_{x_t} \alpha(x_t)&lt;/math&gt; </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;p(y_{1:t}) = \sum_{x_t} p(x_t, y_{1:t}) = \sum_{x_t} \alpha(x_t)&lt;/math&gt; </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>and the required conditional probability &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; as</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>and the required conditional probability &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; as</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;p(x_t|y_{1:t}) = \frac{p(x_t,y_{1:t})}{p(y_{1:t})} = \frac{\alpha(x_t)}{\<del style="font-weight: bold; text-decoration: none;">beta_t</del>}.&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;p(x_t|y_{1:t}) = \frac{p(x_t,y_{1:t})}{p(y_{1:t})} = \frac{\alpha(x_t)}{\<ins style="font-weight: bold; text-decoration: none;">sum_{x_t} \alpha(x_t)</ins>}.&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once the conditional probability has been calculated, we can also find the point estimate of &lt;math&gt;x_t&lt;/math&gt;. For instance, the MAP estimate of &lt;math&gt;x_t&lt;/math&gt; is given by</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once the conditional probability has been calculated, we can also find the point estimate of &lt;math&gt;x_t&lt;/math&gt;. For instance, the MAP estimate of &lt;math&gt;x_t&lt;/math&gt; is given by</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 54:</td> <td colspan="2" class="diff-lineno">Line 58:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>while the MMSE estimate of &lt;math&gt;x_t&lt;/math&gt; is given by </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>while the MMSE estimate of &lt;math&gt;x_t&lt;/math&gt; is given by </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\widehat{x}_t^{MMSE} = \mathbb{E}[x_t|y_{1:t}] = \sum_{x_t} x_t p(x_t|y_{1:t}) = \frac{<del style="font-weight: bold; text-decoration: none;">1}</del>{\<del style="font-weight: bold; text-decoration: none;">beta_t</del>}\sum_{x_t}<del style="font-weight: bold; text-decoration: none;"> x_t</del> \alpha(x_t).&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\widehat{x}_t^{MMSE} = \mathbb{E}[x_t|y_{1:t}] = \sum_{x_t} x_t p(x_t|y_{1:t}) = \frac{<ins style="font-weight: bold; text-decoration: none;">\sum_</ins>{<ins style="font-weight: bold; text-decoration: none;">x_t} x_t </ins>\<ins style="font-weight: bold; text-decoration: none;">alpha(x_t)</ins>}<ins style="font-weight: bold; text-decoration: none;">{</ins>\sum_{x_t} \alpha(x_t)<ins style="font-weight: bold; text-decoration: none;">}</ins>.&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The forward algorithm is easily modified to account for observations from variants of the hidden Markov model as well, such as the [[Linear–quadratic_regulator#Finite-horizon,_discrete-time_LQR|Markov jump linear system]].</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The forward algorithm is easily modified to account for observations from variants of the hidden Markov model as well, such as the [[Linear–quadratic_regulator#Finite-horizon,_discrete-time_LQR|Markov jump linear system]].</div></td> </tr> </table> Manoguru https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220751927&oldid=prev Manoguru: /* Algorithm */ further explanation 2024-04-25T18:12:39Z <p><span class="autocomment">Algorithm: </span> further explanation</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 18:12, 25 April 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 14:</td> <td colspan="2" class="diff-lineno">Line 14:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Algorithm==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Algorithm==</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The goal of the forward algorithm is to compute the [[Joint probability distribution|joint probability]] &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt;, where for notational convenience we have abbreviated &lt;math&gt;x(t)&lt;/math&gt; as &lt;math&gt;x_t&lt;/math&gt; and &lt;math&gt;(y(1), y(2), ..., y(t))&lt;/math&gt; as &lt;math&gt;y_{1:t}&lt;/math&gt;. Once the joint probability &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; is computed, the other probabilities &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; and &lt;math&gt;p(y_{1:t})&lt;/math&gt; are easily obtained. Both the state &lt;math&gt;x_t&lt;/math&gt; and observation &lt;math&gt;y_t&lt;/math&gt; are assumed to be discrete, finite random variables. The model's transition probabilities &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt; and emission probabilities &lt;math&gt;p(y_t|x_t)&lt;/math&gt; are assumed to be known. Computing &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; directly would require [[Marginal distribution|marginalizing]] over all possible state sequences &lt;math&gt;\{x_{1:t-1}\}&lt;/math&gt;, the number of which grows exponentially with &lt;math&gt;t&lt;/math&gt;. Instead, the forward algorithm takes advantage of the [[conditional independence]] rules of the [[hidden Markov model]] (HMM) to perform the calculation recursively.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The goal of the forward algorithm is to compute the [[Joint probability distribution|joint probability]] &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt;, where for notational convenience we have abbreviated &lt;math&gt;x(t)&lt;/math&gt; as &lt;math&gt;x_t&lt;/math&gt; and &lt;math&gt;(y(1), y(2), ..., y(t))&lt;/math&gt; as &lt;math&gt;y_{1:t}&lt;/math&gt;. Once the joint probability &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; is computed, the other probabilities &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; and &lt;math&gt;p(y_{1:t})&lt;/math&gt; are easily obtained. Both the state &lt;math&gt;x_t&lt;/math&gt; and observation &lt;math&gt;y_t&lt;/math&gt; are assumed to be discrete, finite random variables. The model's<ins style="font-weight: bold; text-decoration: none;"> state</ins> transition probabilities &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt; and <ins style="font-weight: bold; text-decoration: none;">observation/</ins>emission probabilities &lt;math&gt;p(y_t|x_t)&lt;/math&gt; are assumed to be known. Computing &lt;math&gt;p(x_t,y_{1:t})&lt;/math&gt; directly would require [[Marginal distribution|marginalizing]] over all possible state sequences &lt;math&gt;\{x_{1:t-1}\}&lt;/math&gt;, the number of which grows exponentially with &lt;math&gt;t&lt;/math&gt;. Instead, the forward algorithm takes advantage of the [[conditional independence]] rules of the [[hidden Markov model]] (HMM) to perform the calculation recursively.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To demonstrate the recursion, let</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To demonstrate the recursion, let</div></td> </tr> </table> Manoguru https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220749588&oldid=prev Manoguru: some structural changes with some additional information 2024-04-25T17:55:45Z <p>some structural changes with some additional information</p> <a href="//en.wikipedia.org/w/index.php?title=Forward_algorithm&amp;diff=1220749588&amp;oldid=1220635792">Show changes</a> Manoguru https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220635792&oldid=prev Manoguru: /* Algorithm */ correction 2024-04-25T00:15:33Z <p><span class="autocomment">Algorithm: </span> correction</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 00:15, 25 April 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 33:</td> <td colspan="2" class="diff-lineno">Line 33:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Thus, since &lt;math&gt;p(y_t|x_t)&lt;/math&gt; and &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt; are given by the model's [[Hidden Markov model#Structural_architecture|emission distributions]] and [[Hidden Markov model#Structural_architecture|transition probabilities]], which are assumed to be known, one can quickly calculate &lt;math&gt;\alpha(x_t)&lt;/math&gt; from &lt;math&gt;\alpha(x_{t-1})&lt;/math&gt; and avoid incurring exponential computation time. </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Thus, since &lt;math&gt;p(y_t|x_t)&lt;/math&gt; and &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt; are given by the model's [[Hidden Markov model#Structural_architecture|emission distributions]] and [[Hidden Markov model#Structural_architecture|transition probabilities]], which are assumed to be known, one can quickly calculate &lt;math&gt;\alpha(x_t)&lt;/math&gt; from &lt;math&gt;\alpha(x_{t-1})&lt;/math&gt; and avoid incurring exponential computation time. </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The recursion formula given above can be written in a more compact form. Let &lt;math&gt;a_{ij}=p(x_t=<del style="font-weight: bold; text-decoration: none;">j</del>|<del style="font-weight: bold; text-decoration: none;">x_t</del>=<del style="font-weight: bold; text-decoration: none;">i</del>)&lt;/math&gt; be the transition probabilities and &lt;math&gt;b_{ij}=p(y_t=<del style="font-weight: bold; text-decoration: none;">j</del>|x_t=<del style="font-weight: bold; text-decoration: none;">i</del>)&lt;/math&gt; be the emission probabilities, then</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The recursion formula given above can be written in a more compact form. Let &lt;math&gt;a_{ij}=p(x_t=<ins style="font-weight: bold; text-decoration: none;">i</ins>|<ins style="font-weight: bold; text-decoration: none;">x_{t-1}</ins>=<ins style="font-weight: bold; text-decoration: none;">j</ins>)&lt;/math&gt; be the transition probabilities and &lt;math&gt;b_{ij}=p(y_t=<ins style="font-weight: bold; text-decoration: none;">i</ins>|x_t=<ins style="font-weight: bold; text-decoration: none;">j</ins>)&lt;/math&gt; be the emission probabilities, then</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\mathbf{\alpha}_t = \mathbf{b}<del style="font-weight: bold; text-decoration: none;">_j</del> \odot \mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\mathbf{\alpha}_t = \mathbf{b}<ins style="font-weight: bold; text-decoration: none;">_i^T</ins> \odot \mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>where &lt;math&gt;\mathbf{A} = [a_{ij}]&lt;/math&gt; is the transition probability matrix, &lt;math&gt;\mathbf{b}<del style="font-weight: bold; text-decoration: none;">_j</del>&lt;/math&gt; is the <del style="font-weight: bold; text-decoration: none;">j</del>-th <del style="font-weight: bold; text-decoration: none;">column</del> of the emission probability matrix &lt;math&gt;\mathbf{B} = [b_{ij}]&lt;/math&gt; which corresponds to the actual observation &lt;math&gt;y_t = <del style="font-weight: bold; text-decoration: none;">j</del>&lt;/math&gt;, and &lt;math&gt;\mathbf{\alpha}_t = [\alpha(x_t=1),\ldots, \alpha(x_t=n)]^T&lt;/math&gt; is the alpha vector. The &lt;math&gt;\odot&lt;/math&gt; is the [[Hadamard product (matrices)|hadamard product]] between &lt;math&gt;\mathbf{b}<del style="font-weight: bold; text-decoration: none;">_j</del>&lt;/math&gt; and &lt;math&gt;\mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>where &lt;math&gt;\mathbf{A} = [a_{ij}]&lt;/math&gt; is the transition probability matrix, &lt;math&gt;\mathbf{b}<ins style="font-weight: bold; text-decoration: none;">_i</ins>&lt;/math&gt; is the <ins style="font-weight: bold; text-decoration: none;">i</ins>-th <ins style="font-weight: bold; text-decoration: none;">row</ins> of the emission probability matrix &lt;math&gt;\mathbf{B} = [b_{ij}]&lt;/math&gt; which corresponds to the actual observation &lt;math&gt;y_t = <ins style="font-weight: bold; text-decoration: none;">i</ins>&lt;/math&gt;, and &lt;math&gt;\mathbf{\alpha}_t = [\alpha(x_t=1),\ldots, \alpha(x_t=n)]^T&lt;/math&gt; is the alpha vector. The &lt;math&gt;\odot&lt;/math&gt; is the [[Hadamard product (matrices)|hadamard product]] between &lt;math&gt;\mathbf{b}<ins style="font-weight: bold; text-decoration: none;">_i^T</ins>&lt;/math&gt; and &lt;math&gt;\mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The initial condition is set as some prior probability over &lt;math&gt;x_0&lt;/math&gt; as </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The initial condition is set as some prior probability over &lt;math&gt;x_0&lt;/math&gt; as </div></td> </tr> </table> Manoguru https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220634867&oldid=prev Manoguru: /* Example */ remove unnecessary subscripts 2024-04-25T00:09:01Z <p><span class="autocomment">Example: </span> remove unnecessary subscripts</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 00:09, 25 April 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 80:</td> <td colspan="2" class="diff-lineno">Line 80:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Example==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Example==</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>This example on observing possible states of weather from the observed condition of seaweed. We have observations of seaweed for three consecutive days as dry, damp, and soggy in order. The possible states of weather can be sunny, cloudy, or rainy. In total, there can be &lt;math&gt;3^3=27&lt;/math&gt; such weather sequences. Exploring all such possible state sequences is computationally very expensive. To reduce this complexity, Forward algorithm comes in handy, where the trick lies in using the conditional independence of the sequence steps to calculate partial probabilities, &lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t) = p(x_t,y_{1:t}) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\<del style="font-weight: bold; text-decoration: none;">alpha_{t-1}</del>(x_{t-1})&lt;/math&gt; as shown in the above derivation. Hence, we can calculate the probabilities as the product of the appropriate observation/emission probability, &lt;math&gt;p(y_t|x_t)&lt;/math&gt; ( probability of state &lt;math&gt;y_t&lt;/math&gt; seen at time t from previous observation) with the sum of probabilities of reaching that state at time t, calculated using transition probabilities. This reduces complexity of the problem from searching whole search space to just using previously computed &lt;math&gt;\alpha&lt;/math&gt;'s and transition probabilities.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This example on observing possible states of weather from the observed condition of seaweed. We have observations of seaweed for three consecutive days as dry, damp, and soggy in order. The possible states of weather can be sunny, cloudy, or rainy. In total, there can be &lt;math&gt;3^3=27&lt;/math&gt; such weather sequences. Exploring all such possible state sequences is computationally very expensive. To reduce this complexity, Forward algorithm comes in handy, where the trick lies in using the conditional independence of the sequence steps to calculate partial probabilities, &lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t) = p(x_t,y_{1:t}) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_{t-1})&lt;/math&gt; as shown in the above derivation. Hence, we can calculate the probabilities as the product of the appropriate observation/emission probability, &lt;math&gt;p(y_t|x_t)&lt;/math&gt; ( probability of state &lt;math&gt;y_t&lt;/math&gt; seen at time t from previous observation) with the sum of probabilities of reaching that state at time t, calculated using transition probabilities. This reduces complexity of the problem from searching whole search space to just using previously computed &lt;math&gt;\alpha&lt;/math&gt;'s and transition probabilities.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Applications of the algorithm==</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>==Applications of the algorithm==</div></td> </tr> </table> Manoguru https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220634764&oldid=prev Manoguru: /* Pseudocode */ remove unwanted subscripts 2024-04-25T00:08:20Z <p><span class="autocomment">Pseudocode: </span> remove unwanted subscripts</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 00:08, 25 April 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 70:</td> <td colspan="2" class="diff-lineno">Line 70:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#:emission probabilities, &lt;math&gt;p(y_t|x_t) &lt;/math&gt;, </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#:emission probabilities, &lt;math&gt;p(y_t|x_t) &lt;/math&gt;, </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#:observed sequence, &lt;math&gt;y_{1:T}&lt;/math&gt; </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#:observed sequence, &lt;math&gt;y_{1:T}&lt;/math&gt; </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#:prior probability, &lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_0</del>(x_0)&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>#:prior probability, &lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_0)&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#For &lt;math&gt;t = 1&lt;/math&gt; to &lt;math&gt;T&lt;/math&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>#For &lt;math&gt;t = 1&lt;/math&gt; to &lt;math&gt;T&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#:&lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\<del style="font-weight: bold; text-decoration: none;">alpha_{t-1}</del>(x_{t-1})&lt;/math&gt;.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>#:&lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_{t-1})&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#Calculate &lt;math&gt;\beta_T = \sum_{x_T} \<del style="font-weight: bold; text-decoration: none;">alpha_T</del>(x_T) &lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>#Calculate &lt;math&gt;\beta_T = \sum_{x_T} \<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_T) &lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>#Return &lt;math&gt;p(x_T|y_{1:T})= \frac{\<del style="font-weight: bold; text-decoration: none;">alpha_T</del>(x_T)}{\beta_T}&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>#Return &lt;math&gt;p(x_T|y_{1:T})= \frac{\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_T)}{\beta_T}&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{frame-footer}}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{frame-footer}}</div></td> </tr> </table> Manoguru https://en.wikipedia.org/w/index.php?title=Forward_algorithm&diff=1220634637&oldid=prev Manoguru: /* Algorithm */ removing unnecessary subscripts 2024-04-25T00:07:26Z <p><span class="autocomment">Algorithm: </span> removing unnecessary subscripts</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 00:07, 25 April 2024</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 21:</td> <td colspan="2" class="diff-lineno">Line 21:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To demonstrate the recursion, let</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To demonstrate the recursion, let</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t) = p(x_t,y_{1:t}) = \sum_{x_{t-1}}p(x_t,x_{t-1},y_{1:t})&lt;/math&gt;.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t) = p(x_t,y_{1:t}) = \sum_{x_{t-1}}p(x_t,x_{t-1},y_{1:t})&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Using the [[Chain rule (probability)|chain rule]] to expand &lt;math&gt;p(x_t,x_{t-1},y_{1:t})&lt;/math&gt;, we can then write</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Using the [[Chain rule (probability)|chain rule]] to expand &lt;math&gt;p(x_t,x_{t-1},y_{1:t})&lt;/math&gt;, we can then write</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(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})&lt;/math&gt;.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(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})&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Because &lt;math&gt;y_t&lt;/math&gt; is conditionally independent of everything but &lt;math&gt;x_t&lt;/math&gt;, and &lt;math&gt;x_t&lt;/math&gt; is conditionally independent of everything but &lt;math&gt;x_{t-1}&lt;/math&gt;, this simplifies to</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Because &lt;math&gt;y_t&lt;/math&gt; is conditionally independent of everything but &lt;math&gt;x_t&lt;/math&gt;, and &lt;math&gt;x_t&lt;/math&gt; is conditionally independent of everything but &lt;math&gt;x_{t-1}&lt;/math&gt;, this simplifies to</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\<del style="font-weight: bold; text-decoration: none;">alpha_{t-1}</del>(x_{t-1})&lt;/math&gt;.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t) = p(y_t|x_t)\sum_{x_{t-1}}p(x_t|x_{t-1})\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_{t-1})&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Thus, since &lt;math&gt;p(y_t|x_t)&lt;/math&gt; and &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt; are given by the model's [[Hidden Markov model#Structural_architecture|emission distributions]] and [[Hidden Markov model#Structural_architecture|transition probabilities]], which are assumed to be known, one can quickly calculate &lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t)&lt;/math&gt; from &lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_{t-1}</del>(x_{t-1})&lt;/math&gt; and avoid incurring exponential computation time. </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Thus, since &lt;math&gt;p(y_t|x_t)&lt;/math&gt; and &lt;math&gt;p(x_t|x_{t-1})&lt;/math&gt; are given by the model's [[Hidden Markov model#Structural_architecture|emission distributions]] and [[Hidden Markov model#Structural_architecture|transition probabilities]], which are assumed to be known, one can quickly calculate &lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t)&lt;/math&gt; from &lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_{t-1})&lt;/math&gt; and avoid incurring exponential computation time. </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>The recursion formula given above can be written in a more compact form. Let<del style="font-weight: bold; text-decoration: none;"> as</del> &lt;math&gt;a_{ij}=p(x_t=j|x_t=i)&lt;/math&gt; be the transition probabilities and &lt;math&gt;b_{ij}=p(y_t=j|x_t=i)&lt;/math&gt; be the emission probabilities, then</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>The recursion formula given above can be written in a more compact form. Let &lt;math&gt;a_{ij}=p(x_t=j|x_t=i)&lt;/math&gt; be the transition probabilities and &lt;math&gt;b_{ij}=p(y_t=j|x_t=i)&lt;/math&gt; be the emission probabilities, then</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\mathbf{\alpha}_t = \mathbf{b}_j \odot \mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\mathbf{\alpha}_t = \mathbf{b}_j \odot \mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>where &lt;math&gt;\mathbf{A} = [a_{ij}]&lt;/math&gt; is the transition probability matrix, &lt;math&gt;\mathbf{b}_j&lt;/math&gt; is the j-th column of the emission probability matrix &lt;math&gt;\mathbf{B} = [b_{ij}]&lt;/math&gt; which corresponds to the actual observation &lt;math&gt;y_t = j&lt;/math&gt;, and &lt;math&gt;\mathbf{\alpha}_t = [\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t=1),\ldots, \<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t=n)]^T&lt;/math&gt; is the alpha vector. The &lt;math&gt;\odot&lt;/math&gt; is the [[Hadamard product (matrices)|hadamard product]] between &lt;math&gt;\mathbf{b}_j&lt;/math&gt; and &lt;math&gt;\mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;.</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>where &lt;math&gt;\mathbf{A} = [a_{ij}]&lt;/math&gt; is the transition probability matrix, &lt;math&gt;\mathbf{b}_j&lt;/math&gt; is the j-th column of the emission probability matrix &lt;math&gt;\mathbf{B} = [b_{ij}]&lt;/math&gt; which corresponds to the actual observation &lt;math&gt;y_t = j&lt;/math&gt;, and &lt;math&gt;\mathbf{\alpha}_t = [\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t=1),\ldots, \<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t=n)]^T&lt;/math&gt; is the alpha vector. The &lt;math&gt;\odot&lt;/math&gt; is the [[Hadamard product (matrices)|hadamard product]] between &lt;math&gt;\mathbf{b}_j&lt;/math&gt; and &lt;math&gt;\mathbf{A} \mathbf{\alpha}_{t-1}&lt;/math&gt;.</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The initial condition is set as some prior probability over &lt;math&gt;x_0&lt;/math&gt; as </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The initial condition is set as some prior probability over &lt;math&gt;x_0&lt;/math&gt; as </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_0</del>(x_0) = p(x_0)&lt;/math&gt; such that &lt;math&gt;\sum_{x_0} \<del style="font-weight: bold; text-decoration: none;">alpha_0</del>(x_0) = 1.&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_0) = p(x_0)&lt;/math&gt; such that &lt;math&gt;\sum_{x_0} \<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_0) = 1.&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>Once the joint probability &lt;math&gt;\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t) = p(x_t,y_{1:t})&lt;/math&gt; has been computed using the forward algorithm, we can easily obtain the related joint probability &lt;math&gt;p(y_{1:t})&lt;/math&gt; as</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>Once the joint probability &lt;math&gt;\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t) = p(x_t,y_{1:t})&lt;/math&gt; has been computed using the forward algorithm, we can easily obtain the related joint probability &lt;math&gt;p(y_{1:t})&lt;/math&gt; as</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\beta_t = p(y_{1:t}) = \sum_{x_t} p(x_t, y_{1:t}) = \sum_{x_t} \<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t)&lt;/math&gt; </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\beta_t = p(y_{1:t}) = \sum_{x_t} p(x_t, y_{1:t}) = \sum_{x_t} \<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t)&lt;/math&gt; </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>and the required conditional probability &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; as</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>and the required conditional probability &lt;math&gt;p(x_t|y_{1:t})&lt;/math&gt; as</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;p(x_t|y_{1:t}) = \frac{p(x_t,y_{1:t})}{p(y_{1:t})} = \frac{\<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t)}{\beta_t}.&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;p(x_t|y_{1:t}) = \frac{p(x_t,y_{1:t})}{p(y_{1:t})} = \frac{\<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t)}{\beta_t}.&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once the conditional probability has been calculated, we can also find the point estimate of &lt;math&gt;x_t&lt;/math&gt;. For instance, the MAP estimate of &lt;math&gt;x_t&lt;/math&gt; is given by</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once the conditional probability has been calculated, we can also find the point estimate of &lt;math&gt;x_t&lt;/math&gt;. For instance, the MAP estimate of &lt;math&gt;x_t&lt;/math&gt; is given by</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\widehat{x}_t^{MAP} = \arg \max_{x_t} \; p(x_t|y_{1:t}) = \arg \max_{x_t} \; \<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t),&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\widehat{x}_t^{MAP} = \arg \max_{x_t} \; p(x_t|y_{1:t}) = \arg \max_{x_t} \; \<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t),&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>while the MMSE estimate of &lt;math&gt;x_t&lt;/math&gt; is given by </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>while the MMSE estimate of &lt;math&gt;x_t&lt;/math&gt; is given by </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\widehat{x}_t^{MMSE} = \mathbb{E}[x_t|y_{1:t}] = \sum_{x_t} x_t p(x_t|y_{1:t}) = \frac{1}{\beta_t}\sum_{x_t} x_t \<del style="font-weight: bold; text-decoration: none;">alpha_t</del>(x_t).&lt;/math&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>::&lt;math&gt;\widehat{x}_t^{MMSE} = \mathbb{E}[x_t|y_{1:t}] = \sum_{x_t} x_t p(x_t|y_{1:t}) = \frac{1}{\beta_t}\sum_{x_t} x_t \<ins style="font-weight: bold; text-decoration: none;">alpha</ins>(x_t).&lt;/math&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The forward algorithm is easily modified to account for observations from variants of the hidden Markov model as well, such as the [[Linear–quadratic_regulator#Finite-horizon,_discrete-time_LQR|Markov jump linear system]].</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The forward algorithm is easily modified to account for observations from variants of the hidden Markov model as well, such as the [[Linear–quadratic_regulator#Finite-horizon,_discrete-time_LQR|Markov jump linear system]].</div></td> </tr> </table> Manoguru