Statistical Inference in Hidden Markov Models using $k$-segment Constraints

Michalis K. Titsias, Christopher Yau, Christopher C. HolmesarXiv 2013 · DOI

Abstract

Hidden Markov models (HMMs) are one of the most widely used statistical methods for analyzing sequence data. However, the reporting of output from HMMs has largely been restricted to the presentation of the most-probable (MAP) hidden state sequence, found via the Viterbi algorithm, or the sequence of most probable marginals using the forward-backward (F-B) algorithm. In this article, we expand the amount of information we could obtain from the posterior distribution of an HMM by introducing linear-time dynamic programming algorithms that, we collectively call $k$-segment algorithms, that allow us to i) find MAP sequences, ii) compute posterior probabilities and iii) simulate sample paths conditional on a user specified number of segments, i.e. contiguous runs in a hidden state, possibly of a particular type. We illustrate the utility of these methods using simulated and real examples and highlight the application of prospective and retrospective use of these methods for fitting HMMs or exploring existing model fits.

Introduction

Hidden Markov Models (HMMs) are fundamental tools in sequence analysis, yet standard inference techniques like the Viterbi or Forward-Backward algorithms often act as "blunt instruments." While they provide the most likely state sequence or marginal probabilities, they lack the flexibility to incorporate domain-specific constraints, such as a known or expected number of segments (contiguous runs of a state).

Standard Hidden Markov Model (HMM) structure

For instance, in genomics, a researcher might know a chromosome should only exhibit a few copy-number changes, but noise might lead a standard HMM to predict dozens. Conversely, in text retrieval, one might seek the "top 3" most relevant sections. Existing change-point detection algorithms that handle such constraints typically suffer from $O(N^2)$ time complexity, making them impractical for large-scale modern datasets.

Methods: State-Space Augmentation

The authors introduce $k$-segment inference algorithms to bridge the gap between HMMs and constrained change-point problems. The core innovation is the use of auxiliary counting variables to expand the hidden state space.

Augmented HMM structure with auxiliary counting variables $s_n$

Instead of tracking only the state $x_n$, the model tracks a pair $(x_n, s_n)$, where $s_n$ is a counter that increments upon transitions to different states. Because $s_n$ is a deterministic function of the state sequence, it adds state-space volume without increasing stochastic complexity. By exploiting this structure, the authors adapt Viterbi, Forward-Backward, and Forward-Filtering-Backward-Sampling (FF-BS) to run in $O(k_{max}M^2N)$ time. This linear scaling with sequence length $N$ is a significant improvement over traditional $O(N^2)$ methods.

Applications and Datasets

The framework was evaluated across diverse domains:

  • Cancer Genomics: Analysis of SNP microarray data from the SW837 colorectal cancer cell line (Chromosome 1). With approximately $10^6$ data points, the linear-time efficiency of the $k$-segment approach was essential.
  • Text Retrieval: A corpus of 119 doctoral theses from the University of Oxford, where the model was used to identify relevant sections (e.g., Economics vs. non-Economics).
  • Simulated Sequences: Used to validate reconstruction accuracy and demonstrate the difference between retrospective exploration of pre-fitted models and prospective fitting with constraints.

Key Insights and Results

The $k$-segment approach enables posterior exploration through a "coarse-to-fine" hierarchy. By observing how the model adds segments as $k$ increases, researchers gain a more nuanced understanding than a single Viterbi path provides.

In the SW837 genomic analysis, the method successfully filtered noise to identify robust copy-number alterations, revealing alternative segmentations hidden in standard outputs. In text retrieval, the $k$-segment method outperformed standard Viterbi MAP paths in "top-k" extraction tasks, offering a more flexible ROC curve for decision-making.

Conclusion

The $k$-segment algorithms provide a powerful extension to the HMM toolkit, maintaining linear efficiency while allowing for sophisticated constrained inference. While computational overhead scales with $k$, the method remains highly effective for fields like genomics where $k \ll N$. Future work may involve using these constraints to automatically learn sparse transition matrices or as inputs for meta-statistical models.

Summary updated

BibTeX
@misc{titsias2013statistical,
  author = {Michalis K. Titsias and Christopher Yau and Christopher C. Holmes},
  title = {{Statistical Inference in Hidden Markov Models using $k$-segment Constraints}},
  year = {2013},
  eprint = {1311.1189},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1311.1189},
}
Figure