Forward-backward algorithm

The forward-backward algorithm is a dynamic programming algorithm for computing the probability of a particular output sequence, given the parameters of the model, in the context of hidden Markov models.

A brute force procedure for the solution of this problem is the generation of all possible sequences of observed events and hidden states with their probabilities using the two transition matrices. The joint probability of two sequences, given the model, is calculated by multiplying the corresponding probabilities. This procedure has a time complexity of $$ O(2\cdot T \cdot N^T) $$, where $$T$$ is the length of sequences and $$N$$ is the number of symbols in the state alphabet. This is intractable for realistic problems, as the number of possible hidden node sequences typically is extremely high.