See, with pictures and motion, how a “true state” that cannot be seen directly is guessed from clues that arrive at each time step (thermometer readings, or measurements that wobble).
Whether a machine is “normal” or “degraded” (the hidden state) cannot be seen directly; only sensor values (observations) arrive at each time step. From the sequence of observations, estimate the hidden states. Check with the numbers plugged into the formulas: the difference between filtering by the forward algorithm (uses the observations up to that time) and smoothing γt that also uses the backward algorithm (uses the observations at all times); the fact that the most probable state sequence (Viterbi algorithm) can differ from the sequence of the most probable state at each time; and that a continuous hidden state leads to the Kalman filter.
The inside of the furnace cannot be seen from outside; only a thermometer reading (Low, Mid, High) arrives every hour. Each time a reading arrives, the line for “the probability that it is degraded now” is extended.
These are synthetic data for teaching purposes (the furnace states and readings are made up; the true states can be seen with “Check the answer”).
The display (×) of the scale you step on every morning wobbles a little away from your true weight. Each time a display arrives, the estimate of the true weight (line) and its range (band) are updated.
These are synthetic data for teaching purposes (the changes in weight and the displays of the scale are made up).
Observation sequence and true states
“Advance time” moves the time t under study (vertical dashed line), and “Putting the current numbers into the formula” below shows one step of the forward algorithm at that time.
Probability of degradation: filtering and smoothing
The dashed line is filtering p(zt = 2 | x1:t) (uses only the observations up to time t); the solid line is smoothing γt(2) = p(zt = 2 | x1:T) (uses the observations at all times). The hatched bands mark the times when the true state is degraded. State numbers: 1 = normal, 2 = degraded.
State sequences (estimated and true)
In each row, a filled cell means the time is estimated as “degraded” and a white cell means “normal.” A small ▲ under a cell marks a time that differs from the true state. “γ max” is the sequence of the state with the largest γt(j) at each time, “Filter” is the sequence of the state with the largest filtering probability, and Viterbi is the state sequence with the largest joint probability p(x1:T, z1:T).
p(zt = 2 | x1:t−1) is the prediction from the observations up to one step earlier, and ct = p(xt | x1:t−1) is the normalizing coefficient. The value for state 1 (normal) is obtained by subtracting from 1 (there are only two states). α̂t(j) is the normalized forward variable, which is exactly the filtering probability.
Lattice diagram for the hand calculation (2 states, 3 time steps)
Each cell shows αt(j), βt(j), and γt(j). The thick green arrows are the Viterbi path, and the double frame marks the state with the largest γt at each time.
True state, observations, and the Kalman filter estimate
The hidden state zt moves as a random walk, and noise is added to the observation xt. The plot shows the estimated mean μt and a band of ±2√Pt.
Evolution of the Kalman gain Kt and the estimate variance Pt
The dotted horizontal lines are the steady-state values K∞ and P∞. At times when the observation is missing (hatched bands) no update is possible, so Kt = 0 and Pt grows by q at every step. At times with an observation, Pt = Ktr, so for r = 1 the two lines overlap (dashed line on top of the thick solid line).
The description of this simulator (procedure, formulas, conditions, questions) is on the explanation page “Explanation of the Sequence Models Simulator”.
Back to Machine Learning — From Probability to GPT (Contents) | Text: Chapter 22, Section 22.5 | Equations and explanation (explanation page) | Equations are typeset with the browser’s built-in MathML (no external library).