On Learning Markov Chains

Yi Hao, Alon Orlitsky, Venkatadheeraj Pichapati

Introduction

In the landscape of statistical learning, the problem of estimating a discrete distribution from independent and identically distributed (i.i.d.) samples is well-understood. For i.i.d. data, the sample complexity and minimax risk are established, with the risk typically scaling at a rate of $1/n$. However, real-world data—ranging from natural language sequences to financial time series—rarely adheres to the i.i.d. assumption. Instead, these data streams are characterized by temporal dependencies where the current state is influenced by its predecessors.

The Markov chain serves as the fundamental model for such sequential data. Despite its ubiquity, the fundamental limits of learning unknown $k$-state Markov chains from a single sequence of $n$ samples have remained surprisingly elusive. This paper addresses this gap by establishing minimax risk bounds for two primary tasks: predicting the next state and estimating the underlying transition matrix.

The Core Challenges: Prediction vs. Estimation

The authors distinguish between two learning objectives:

  1. Prediction: Given an observed sequence $X_1, \dots, X_n$, the goal is to predict the distribution of the subsequent state $X_{n+1}$.
  2. Estimation: The goal is to reconstruct the entire $k \times k$ transition matrix $M$ from the sequence.

The primary difficulty in learning Markov chains, as opposed to i.i.d. distributions, lies in the phenomenon of "rare states." In an i.i.d. setting, a rare symbol has a negligible impact on the overall loss. In a Markovian setting, however, a state may be visited infrequently, but once the system enters that state, the learner must accurately know its specific transition probabilities to make a valid prediction. This dependency creates a bottleneck in learning efficiency.

Methodological Approach

The research utilizes a minimax framework to determine the optimal performance achievable by any estimator in the worst-case scenario.

Lower Bounds

To establish the fundamental limits, the authors construct a "prior" over a set of difficult-to-learn Markov chains. By setting transition probabilities to $1/\log^t n$, they create scenarios where the "last seen" state is highly likely to have been encountered only a few times. This construction proves that the uncertainty inherent in these rare transitions imposes a strictly higher risk than the i.i.d. case.

Upper Bounds and Estimators

The authors analyze and refine the classical add-$\beta$ estimator (Laplace smoothing).

  • For Prediction: They propose a modified estimator that adjusts its smoothing parameter based on the visitation frequency of a state relative to the total sequence length.
  • For Estimation: To mitigate the instability of early samples, they introduce a "warm-up" period. By discarding the first $\sqrt{n}$ samples, the chain is allowed to reach its stationary distribution, ensuring that subsequent counts are more stable and amenable to concentration inequalities.

Key Insights: The $\log \log n$ Factor

The most significant theoretical contribution is the discovery that the minimax risk for predicting Markov chains scales as $\Theta(\frac{\log \log n}{n})$. This contrasts sharply with the i.i.d. rate of $\frac{k-1}{2n}$. The additional $\log \log n$ factor represents the "price of sequentiality"—the inherent difficulty of predicting transitions from states with sparse historical data.

Furthermore, the paper demonstrates that prediction and estimation are fundamentally different. Prediction can be performed effectively even if rare states are not fully learned, as they are (by definition) unlikely to be encountered. However, for the total estimation risk of the transition matrix to vanish, one must assume that transition probabilities are bounded away from zero (i.e., every entry $\ge \delta$). Without this assumption, the risk associated with unobserved states remains constant, preventing the estimator from converging to the true matrix.

Results and Validation

The theoretical findings are supported by synthetic simulations using transition matrices generated via $k$-Dirichlet(1) distributions. Experiments varied $n$ (up to 100,000) and $k$ (up to 36) to confirm the functional forms of the derived risk bounds.

  • Prediction Risk: The minimax KL-prediction risk for a $k$-state Markov chain is bounded by: $$\frac{(k-1) \log \log n}{4en} \lesssim \rho_n^{KL}(M^k) \lesssim \frac{2k^2 \log \log n}{n}$$
  • Estimation Risk: For transition matrices with entries $\ge \delta$, the risk for ordinary $f$-divergences scales as $\Theta(\frac{k}{n\delta})$.
  • $L_2$ Distance: For squared Euclidean distance, the risk scales as $\Theta(\frac{k}{n})$. A novel add-$\sqrt{N_i}/k$ estimator was shown to outperform standard Laplace smoothing in these contexts.

Limitations and Future Directions

While this work provides a rigorous foundation for learning Markov chains, several questions remain:

  • The Alphabet Gap: There is a discrepancy between the lower bound (linear in $k$) and the upper bound (quadratic in $k$) for prediction risk. Closing this gap is a priority for future work.
  • Large Alphabet Regime: The current analysis assumes $k \ll n$. Extending these results to regimes where the number of states $k$ scales with the number of samples $n$ is a significant open challenge.
  • Relaxing Boundedness: Future research may explore ways to characterize estimation risk without the $\delta$ parameter, perhaps by employing alternative loss measures that do not penalize unobserved transitions as heavily.

Summary updated

BibTeX
@inproceedings{hao2018learning,
  author = {Yi Hao and Alon Orlitsky and Venkatadheeraj Pichapati},
  title = {{On Learning Markov Chains}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
  url = {https://openreview.net/forum?id=B1NgguZ_-S},
}
Figure