Deep Explicit Duration Switching Models for Time Series

Abdul Fatir Ansari, Konstantinos Benidis, Richard Kurle, Ali Caner Turkmen, Harold Soh, Alex Smola, Bernie Wang, Tim Januschowski

TL;DR

The authors introduce RED-SDS (Recurrent Explicit Duration Switching Dynamical System), a flexible model designed to capture both state-dependent and time-dependent switching in complex time series. By combining neural inference for continuous states with exact inference for discrete regime durations, the model achieves superior performance in segmenting complex behaviors and competitive accuracy in forecasting.

What Problem Does This Paper Address?

Many real-world time series are not generated by a single continuous process; rather, they consist of distinct "regimes." For example, a city's power consumption dynamics differ drastically between a Monday morning and a Saturday night.

Traditional Switching Dynamical Systems (SDS) attempt to model this by switching between different linear systems. However, they usually suffer from two major flaws:

  1. Memoryless Durations: They often assume the time spent in a regime follows a geometric distribution. This leads to "oversegmentation," where the model switches regimes too frequently and erratically, failing to capture persistent behaviors.
  2. Open-Loop Transitions: The switch to a new regime often depends only on the previous regime, ignoring the actual state of the system (e.g., a bouncing ball only switches direction when it hits a wall, which is a state-dependent event).

The authors aim to bridge this gap by creating a model that knows how long a regime should last and when the internal state should trigger a change.

Methods

The core contribution of the paper is the RED-SDS model, which features three main components to address the limitations of standard SDS:

  • Recurrent State-to-Switch Connections: The probability of switching to a new regime is conditioned on the previous continuous latent state ($x_{t-1}$), allowing for "closed-loop" behavior.
  • Explicit Duration Modeling: It introduces a "count" variable ($c_t$) that tracks how long the system has been in the current regime. This allows the model to learn that a specific behavior (like a "waggle dance" in bees) typically lasts for a certain number of timesteps.
  • Hybrid Inference Algorithm: Because exact inference in non-linear switching models is mathematically intractable (scaling exponentially), the authors use a clever hybrid approach.
Graphical representation of the RED-SDS generative model and inference network.

As shown in the architecture above, an Inference Network (using Bi-RNNs or Transformers) approximates the posterior of the continuous latent states. Meanwhile, a Forward-Backward routine (similar to those used in Hidden Semi-Markov Models) performs exact inference for the discrete switches and duration counts. The model is trained by maximizing a Monte Carlo lower bound of the marginal log-likelihood, essentially rewarding the model for accurately reconstructing the data while maintaining a consistent internal logic of regimes.

Datasets

The authors evaluated RED-SDS on two distinct fronts:

  • Segmentation Tasks:
    • Bouncing Ball: A univariate series of a ball hitting walls (purely state-dependent).
  • 3-Mode System: A synthetic linear system with three modes and specific duration patterns.
  • Dancing Bees: A real-world dataset of honeybee trajectories. This is a classic benchmark for identifying complex, long-term motion patterns (waggle, turn right, turn left).
  • Forecasting Benchmarks: Five popular public datasets from the GluonTS library: Exchange, Solar, Electricity, Traffic, and Wiki.

Key Insights and Ideas

  • The Power of Inductive Bias: By setting hyperparameters for minimum and maximum duration ($d_{min}, d_{max}$), researchers can bake domain knowledge into the model, helping it ignore noise and focus on meaningful segments.
  • State vs. Time: The model is "smart" enough to figure out which mechanism matters more. In the Bouncing Ball task, it learned to ignore the duration variable because the state (position) perfectly explained the switch. In the 3-Mode system, it accurately recovered the hidden duration distributions.
  • Simplifying the Forecast: One of the key takeaways is that by breaking a complex time series into meaningful regimes (like day/night cycles in electricity usage), the forecasting problem becomes much simpler for the underlying neural networks to solve.

Key Results

RED-SDS demonstrates significant improvements in both segmentation and forecasting:

  • Superior Segmentation: On the "Dancing Bees" dataset, RED-SDS significantly outperformed the previous state-of-the-art (SNLDS). It achieved an Adjusted Rand Index (ARI) of 0.53 compared to SNLDS's 0.10, effectively solving the oversegmentation problem.
Segmentation results across the Bouncing Ball, 3-Mode System, and Dancing Bees datasets, comparing RED-SDS against baselines.
  • Competitive Forecasting: In forecasting tasks, RED-SDS was evaluated using the Continuous Ranked Probability Score (CRPS). It achieved the best results on 4 out of 5 datasets (Exchange, Electricity, Traffic, and Wiki) when compared against strong baselines like DeepAR and DeepState.
  • Interpretability: Unlike "black-box" forecasting models, RED-SDS provides a clear, interpretable map of why it thinks the system is changing, showing the inferred regimes and their expected durations.

Limitations and Future Work

While powerful, the model currently requires manual tuning of the duration bounds ($d_{min}$ and $d_{max}$). If these are set poorly, the segmentation might not be as interpretable. Additionally, the base dynamical systems are parameterized by flexible neural networks; incorporating simpler, structured models (like classical trend/seasonality components) could make the model even more robust for specific industrial applications. Finally, a promising future direction is using the model in semi-supervised scenarios where some regime labels are known, which could further improve accuracy in complex biological or physical systems.

Summary updated

BibTeX
@inproceedings{ansari2021deep,
  author = {Abdul Fatir Ansari and Konstantinos Benidis and Richard Kurle and Ali Caner Turkmen and Harold Soh and Alex Smola and Bernie Wang and Tim Januschowski},
  title = {{Deep Explicit Duration Switching Models for Time Series}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=LaM6G4yrMy0},
}
Figure