Backward algorithm 2026-10-20
The backward algorithm computes suffix likelihoods in a Hidden Markov model. With , its recurrence is . Together with the forward algorithm, it gives posterior state probabilities proportional to . The terminal condition must include any explicit End-state transition.
Daniel Jurafsky 2026-11-05
Daniel Jurafsky coauthored Speech and Language Processing by Daniel Jurafsky and James H. Martin. The text presents mathematical models and computational procedures for natural language processing, including sequence models that connect linguistic observations to latent states.[ref]
In a Hidden Markov model, the current hidden state determines the emission distribution and the next-state probabilities. This separation permits the forward algorithm to compute an observation sequence's likelihood by summing locally over preceding states. The assumptions make inference tractable, while their suitability for a particular language task remains a modelling question. A tractable calculation does not by itself establish that the model captures every dependency in real language.
Emission probability 2026-10-20
An emission probability in a Hidden Markov model is the probability of an observation conditional on its hidden state. For a finite observation alphabet, each state's emission probabilities sum to one. A match state can therefore emit several different characters, each with its own probability.
Forward algorithm 2026-10-20
The forward algorithm computes sequence likelihoods by summing over all hidden paths through a Hidden Markov model. For emitting states, obeys . It reuses partial sums rather than enumerating exponentially many state sequences. Silent states require additional transitions without consuming an observation. Scaling or log-sum-exp prevents floating-point underflow.
Hidden Markov model Created 2026-09-28 Updated 2026-11-05
A Hidden Markov model combines an unobserved Markov chain with observations . Given the whole hidden-state path, the observations have conditional independence, and the conditional distribution of depends only on . The state-transition assumption and this emission assumption are separate parts of the model.[ref]
For a time-homogeneous model with a finite hidden state space and discrete observations, write , and for the emission probabilities. The joint probability mass function factors as
For continuous observations, appropriate probability density functions replace the emission probability mass functions.
For example, a hidden state can describe whether a machine is working normally or has a fault, while a noisy sensor emits a positive or negative signal. Both states may emit a positive signal, with different probabilities; one observation therefore need not identify the state. Summing the factorization over hidden paths gives the observation likelihood. The forward algorithm reuses partial sums to compute it, and the backward algorithm helps infer hidden-state posterior probabilities. The observations alone need not satisfy the Markov property.
James H. Martin 2026-11-05
James H. Martin coauthored Speech and Language Processing by Daniel Jurafsky and James H. Martin with Daniel Jurafsky. Its treatment connects natural language processing to explicit probabilistic models and algorithms. The hidden-state appendix gives the initial, transition and emission distributions of a Hidden Markov model and derives the forward algorithm.[ref]
For a sequence of observations, the forward calculation sums over possible hidden-state histories instead of selecting only one best history. Sharing partial calculations avoids enumerating every full state sequence. The resulting efficiency comes from the model's conditional-independence assumptions, not from treating arbitrary sequences as independent.
With no deletion states allowed, each match state must emit once in every aligned sequence. Thus the four gap-free alignment columns, , become . Columns and form one optional run, represented by a single looping insertion state ; column requires a separate insertion state after . Two insertion states are sufficient and minimal in an ordered profile hidden Markov model: the two optional regions are separated by a compulsory emission and occupy different positions in the profile.
Estimate each transition probability by the number of observed uses of that transition divided by all transitions leaving its source state. The complete arrow diagram is given below; repeated labels denote the same state, so the second and third lines supply the branches of the first line. Start and End are silent:
Three aligned sequences visit , giving three exits to , while one sequence emits twice there, giving one self-transition. Thus its exit and loop probabilities are and , respectively. Two sequences visit and two bypass it. All absent transitions have probability zero.
The probability mass functions of the emitting states, estimated from all characters assigned to each state with no added counts, are
In particular, pooling the two optional columns into pools four emissions: two T, one A and one G. This is a generative Hidden Markov model, so it can generate other run lengths and combinations as well as the training sequences; reproducing each training column deterministically is not its purpose.
Let be the false positive rate for a genuinely cancer-free person, encompassing the harmless-tumour misclassification, and assume screening errors are conditionally independent given the latent states. A pre-clinical case tests positive with probability one; a clinical case is separately recognized. Thus a negative screen identifies latent state , whereas a positive pre-clinical screen can arise from state or . This is a Hidden Markov model with a screening misclassification model.
Conditional on the negative baseline screen, the state at year is . The negative screen at year requires staying in state for two years and then testing negative. From that state, the positive screen at year can arise either with probability while still disease-free or through pre-clinical disease. Consequently the conditional likelihood is
If the study instead specifies an initially disease-free patient and includes the baseline screening result in the likelihood function, its probability contributes a further factor , giving
The formulas use the positive emission for a pre-clinical screen, with no clinical diagnosis in this record. A persistent harmless-tumour subtype producing correlated screening errors would need an additional latent-state or emission specification; its likelihood is not determined by the single parameter .
One analysis can treat a reported symptom-onset date as the exact transition time. That adds an exactly observed infection-time density to the likelihood, but assumes symptoms begin immediately at infection, every relevant episode is symptomatic, and dates are recalled and reported without error.
A more realistic analysis treats true infection as a latent transition and symptom onset as a noisy observation. A reporting-delay distribution, and possibly probabilities of asymptomatic infection and non-reporting, can be added to a Hidden Markov model. Weekly tests then interval-censor the state transition while the symptom date refines its distribution. This approach uses more information but requires an identifiable and correctly specified symptom-delay and reporting model.