Inverse Filtering for Hidden Markov Models

Robert Mattila, Cristian R. Rojas, Vikram Krishnamurthy, Bo WahlbergNeurIPS 2017

Overview

This paper introduces an efficient method to "reverse engineer" a Hidden Markov Model (HMM). In a standard HMM setup, researchers solve the filtering problem: given a sequence of noisy observations and known system dynamics, they calculate the "posterior"—the best guess of the current hidden state.

However, this paper tackles the inverse filtering problem. By observing only the sequence of state posteriors (the estimator's "beliefs") and knowing the system dynamics, the authors demonstrate how to analytically reconstruct the original observations and the sensor's likelihood probabilities. Crucially, they achieve this using simple linear algebra and clustering, avoiding computationally expensive combinatorial optimization.

Why Does Inverse Filtering Matter?

Solving the inverse filtering problem is a critical challenge across several domains:

  • Fault Detection: It allows engineers to identify if a sensor has been compromised or is malfunctioning by comparing reconstructed observations with redundant data.
  • Reverse Engineering: It helps researchers understand the internal logic of "black box" intelligent systems (like proprietary wearables) that only output processed state estimates rather than raw data.
  • Cognitive Science and Economics: It enables the inference of an agent's internal model or "revealed preferences" based on their observed actions or beliefs.

Previously, solving this required Mixed-Integer Linear Programming (MILP), which is computationally heavy and scales poorly. The authors sought a faster, more elegant solution.

Methodology

The authors exploit the algebraic structure of the HMM filter update equation. Their key insight is that the filter equation can be rearranged into a linear form: $M_k b_{y_k} = 0$, where $M_k$ is a matrix derived from the posteriors and $b_{y_k}$ is a column of the observation likelihood matrix $B$.

  1. The Nullspace Approach: In a noise-free scenario, finding the sensor characteristics becomes a search for the nullspace of a specific matrix. Because the nullspace is one-dimensional, the direction of the sensor's likelihood vector is uniquely determined.
  2. Clustering for Noise: When posteriors are corrupted by noise, the "directions" found via the nullspace also become noisy. The authors employ spherical k-means clustering to group these noisy directions into $Y$ clusters (where $Y$ is the number of possible observation types). The centroids of these clusters represent the estimated sensor characteristics.
  3. Normalization via Linear Programming (LP): Nullspace vectors are only unique up to a scale factor. To resolve this, the authors use a simple Linear Program to properly normalize the reconstructed matrix so that it satisfies the properties of a valid probability matrix (non-negative values with rows summing to one).

Datasets and Real-World Application

The researchers evaluated their algorithms using both synthetic data (to establish theoretical bounds and test noise resilience) and real-world polysomnographic (PSG) data from the PhysioNet CAP Sleep Database.

Real-world polysomnographic data used for automatic sleep segmentation.

The real-world dataset includes EEG readings used for automatic sleep stage segmentation (Wake, S1, S2, SWS, REM). The authors used 1030 quantized EEG samples from a patient to successfully reconstruct the sleep stages and the sensor model directly from the output of an automated sleep-tracker.

Key Insights and Results

  • Algebraic Exploitation: The core breakthrough is realizing that the HMM filter is a set of linear constraints that can be inverted to solve for system parameters, turning a "hard" discrete optimization problem into a "soft" geometric one.
  • Identifiability: The paper provides formal proofs showing exactly when a sensor can be uniquely reconstructed. Specifically, the observation likelihood matrix $B$ must be full column rank, meaning different observations must produce distinct probability distributions.
  • Reconstruction Accuracy and Robustness: In noise-free environments, the algorithm achieves perfect reconstruction of both the observation sequence and the likelihood matrix. Even with moderate noise, the fraction of correctly recovered observations remains high. As the signal-to-noise ratio increases, the error in the likelihood matrix drops exponentially.
  • Efficiency: The proposed method is remarkably fast. Processing over 1,000 real-world sleep samples took less than one second on a standard 2017-era processor.

Limitations and Future Work

While highly effective, the current framework assumes the transition matrix ($P$)—how the hidden state evolves over time—is already known. In many real-world "black box" scenarios, this might be hidden. Additionally, the mathematical proofs rely on the HMM being ergodic (meaning it doesn't get "stuck" in one state forever), which may not hold for all systems.

Future work will explore extending this framework to cases where the system dynamics are unknown, or where the observer can only see the actions taken by an agent based on their beliefs, rather than having access to the full posterior distribution itself.

Summary updated

BibTeX
@inproceedings{mattila2017inverse,
  author = {Robert Mattila and Cristian R. Rojas and Vikram Krishnamurthy and Bo Wahlberg},
  title = {{Inverse Filtering for Hidden Markov Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2017},
  url = {https://openreview.net/forum?id=HJVT1YWdWB},
}
Figure