Example
Page 3 of this section contains an interactive example of the forward algorithm.
To use the example follow these steps : 数据挖掘工具
- Enter a number of valid observed states in the input field.
- Press ′Set′ to initialise the matrix.
- Use either ′Run′ or ′Step′ to make the calculations.
- ′Run′ will calculate the
′s for each and every node and return the probability of the HMM.
- ′Step′ will calculate the
value for the next node only. Its value is displayed in the output window.
When you have finished with the current settings you may press ′Set′ to reinitialise with the current settings, or you may enter a new set of observed states, followed by ′Set′.
数据挖掘研究院
States may be entered in either or a combination of the following : 数据挖掘论坛
Dry, Damp, Soggy
or 数据挖掘研究院
Dry Damp Soggy
i.e. valid separators are comma and space. If any invalid state or separator is used then the states remain unchanged from their previous settings
数据挖掘工具
See next page for the example.
Description of model used in the example
Hidden States (weather) |
| Sunny |
| Cloudy |
| Rainy |
|
Observed States (seaweed) |
| Dry |
| Dryish |
| Damp |
| Soggy |
|
Initial State Probabilities ( Vector) |
| Sunny |
0.63 |
| Cloudy |
0.17 |
| Rainy |
0.20 |
|
Description of model used in the example
State transition matrix (′A′ matrix)
weather yesterday |
weather today |
| |
Sunny |
Cloudy |
Rainy |
| Sunny |
0.500 |
0.250 |
0.250 |
| Cloudy |
0.375 |
0.125 |
0.375 |
| Rainy |
0.125 |
0.675 |
0.375 |
Confusion matrix (′B′ matrix)
hidden states |
observed states |
| |
Dry |
Dryish |
Damp |
Soggy |
| Sunny |
0.60 |
0.20 |
0.15 |
0.05 |
| Cloudy |
0.25 |
0.25 |
0.25 |
0.25 |
| Rainy |
0.05 |
0.10 |
0.35 |
0.50 |
Summary
We use the forward algorithm to find the probability of an observed sequence given a HMM. It exploits recursion in the calculations to avoid the necessity for exhaustive calculation of all paths through the execution trellis.
Given this algorithm, it is straightforward to determine which of a number of HMMs best describes a given observation sequence - the forward algorithm is evaluated for each, and that giving the highest probability selected.