Steering the LoCoMotif: Using Domain Knowledge in Time Series Motif Discovery

Aras Yurtman, Daan Van Wesenbeeck, Wannes Meert, Hendrik BlockeelarXiv 2025 · DOI

Abstract

Time Series Motif Discovery (TSMD) is a fundamental task for identifying repeating patterns in temporal data, such as heartbeats in an ECG or exercise repetitions in wearable sensor data. However, traditional unsupervised TSMD methods often surface mathematically similar but semantically irrelevant noise. We introduce LoCoMotif-DoK, a highly expressive framework that allows users to inject domain knowledge via hard and soft constraints to steer the discovery process. By guiding the search space with expert-defined requirements, LoCoMotif-DoK dramatically improves the relevance and accuracy of discovered patterns across various real-world datasets.

Introduction

The primary challenge in TSMD is that algorithms often find "off-target" motifs. For instance, in an exercise dataset, an unsupervised algorithm might identify a pattern consisting of the end of one repetition and the beginning of the next, rather than the complete movement. While domain experts often possess specific knowledge about the target patterns—such as expected duration or the number of repetitions—existing TSMD techniques offer limited ways to incorporate this information. Most current methods rely on simple binary masks, which lack the expressiveness required for complex real-world constraints.

The LoCoMotif-DoK Framework

LoCoMotif-DoK formulates domain-guided TSMD as a constrained optimization problem. The framework supports two distinct categories of domain knowledge:

  1. Hard Constraints (Requirements): These are strict rules that a motif set must satisfy. Examples include minimum/maximum length, exact cardinality (number of occurrences), or non-overlapping requirements.
  2. Soft Constraints (Preferences): These are defined via desirability functions that score a motif set on a scale from 0 (undesirable) to 1 (perfectly desirable).
The LoCoMotif-DoK framework utilizes motif set constraints and desirability functions to evaluate candidate patterns.

The algorithm operates in two main phases. First, it performs Candidate Generation using Local Concurrences (LoCo) to find similar time segments while allowing for dynamic time warping. Second, it performs Filtering and Scoring, where candidate sets violating hard constraints are discarded, and the remaining sets are ranked based on a combination of similarity fitness and soft constraint scores.

Experimental Evaluation

The authors evaluated LoCoMotif-DoK on a diverse set of data:

  • Physiotherapy Data: 40 real-world accelerometer series of patients performing physical therapy exercises.
  • TSMD Benchmark: A synthetic dataset with ground-truth motifs for quantitative assessment.
  • Real-World Series: Five specialized datasets including ECG (heart activity), EOG (eye movement), and Seismology (earthquakes).

Results and Discussion

LoCoMotif-DoK demonstrated significant performance gains over the baseline LoCoMotif. In the physiotherapy use case, providing simple constraints regarding the expected number of repetitions and approximate length allowed the algorithm to perfectly isolate exercises, whereas the baseline often grouped irrelevant resting periods.

Comparison of motif discovery on physiotherapy data. Without domain knowledge (c), the algorithm identifies fragmented or overlapping patterns. With domain knowledge (d), LoCoMotif-DoK accurately recovers the ground-truth repetitions (b).

Key Insights

  • Expressiveness vs. Masking: Simple start-time masking is insufficient for complex patterns. Combining constraints like cardinality and length range forces the algorithm to find semantic events rather than phase-shifted artifacts.
  • Soft Constraints for Robustness: Strict hard constraints can be brittle in the presence of noise. Soft constraints (e.g., "prefer 10 repetitions but accept 9") yield higher F1-scores by allowing for real-world signal corruption.
  • Anchoring Variable-Length Discovery: While dynamic time warping is powerful, it expands the search space significantly. Domain constraints act as a necessary anchor, making variable-length motif discovery practically viable by filtering out semantically meaningless warped segments.

Conclusion and Future Work

LoCoMotif-DoK successfully bridges the gap between unsupervised discovery and expert intuition. While highly effective, the authors note that applying strict length constraints after candidate generation can be computationally challenging. Future research will focus on integrating these constraints more natively into the time-warping calculations to further enhance efficiency and performance.

Summary updated

Abstract

Time Series Motif Discovery (TSMD) identifies repeating patterns in time series data, but its unsupervised nature might result in motifs that are not interesting to the user. To address this, we propose a framework that allows the user to impose constraints on the motifs to be discovered, where constraints can easily be defined according to the properties of the desired motifs in the application domain. We also propose an efficient implementation of the framework, the LoCoMotif-DoK algorithm. We demonstrate that LoCoMotif-DoK can effectively leverage domain knowledge in real and synthetic data, outperforming other TSMD techniques which only support a limited form of domain knowledge.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
TSMD · benchmarkLoCoMotif-DoKF1-score1Time Series Motif Discovery · split: val · constraint=hard start-and-end points
Source quote
L660: The constraint Start- and End-points yields the greatest improvement, pushing the F1-scores to 1 in most cases, which is expected because the constraint defines the time segments of possible motifs with some flexibility, making the TSMD task much easier.
BibTeX
@misc{yurtman2025steering,
  author = {Aras Yurtman and Daan Van Wesenbeeck and Wannes Meert and Hendrik Blockeel},
  title = {{Steering the LoCoMotif: Using Domain Knowledge in Time Series Motif Discovery}},
  year = {2025},
  eprint = {2502.11850},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.11850},
}
Figure