Inferensys

Glossary

Shapelet Attribution

A technique that identifies and assigns importance to discriminative subsequences (shapelets) in a time series that are most representative of a particular class or prediction.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
DISCRIMINATIVE SUBSEQUENCE IDENTIFICATION

What is Shapelet Attribution?

Shapelet attribution is a time-series interpretability technique that identifies and assigns importance scores to discriminative subsequences (shapelets) within a sequence that are most representative of a particular class or prediction.

Shapelet attribution operates by discovering the phase-independent subsequences that maximize the difference between classes in a time-series dataset. Unlike point-wise attribution methods that assign importance to individual time steps, this technique evaluates entire local patterns—such as a specific spike, dip, or oscillation—and quantifies their predictive power by measuring their distance to the input series.

The core mechanism involves learning or mining a set of candidate shapelets and then attributing a model's decision to the presence or absence of these patterns. This provides a concept-based explanation that is naturally interpretable to domain experts, as it highlights the specific morphological structures driving a classification rather than abstract feature weights.

Discriminative Subsequence Discovery

Key Characteristics of Shapelet Attribution

Shapelet attribution identifies the specific contiguous subsequences within a time series that are most representative of a class or most influential in driving a model's prediction, offering highly interpretable, phase-aware explanations.

01

Phase-Aware Discriminative Patterns

Unlike point-wise attribution methods that highlight isolated time steps, shapelet attribution identifies contiguous subsequences that match a specific, localized pattern. This captures the phase or shape of a signal—such as a specific QRS complex in an ECG or a seasonal dip in sales—rather than just a single anomalous spike. The explanation is a human-interpretable snippet of the original data, making it ideal for domain experts who think in terms of events, not abstract features.

02

Class-Characteristic Prototypes

The core mechanism involves discovering shapelets that serve as class-characteristic prototypes. A shapelet is a subsequence that minimizes the distance to one class while maximizing it to others. Attribution is then performed by measuring the distance between a shapelet and the input time series:

  • Best-match distance: The minimum Euclidean distance between the shapelet and any sliding window of the same length in the input.
  • Decision boundary proximity: The closer the input is to a class-specific shapelet, the stronger the attribution to that class. This provides a case-based reasoning explanation grounded in real data examples.
03

Localized Temporal Saliency

Shapelet attribution generates a localized saliency map by projecting the shapelet's influence back onto the time axis. The specific segment of the input that best matches the shapelet is highlighted as the primary explanatory region. This is fundamentally different from gradient-based methods:

  • Gradient methods produce dense, often noisy importance scores across all time steps.
  • Shapelet methods produce sparse, contiguous blocks of high importance, directly mapping to a single interpretable event. This sparsity makes the explanation cognitively easier to process and verify.
04

Model-Agnostic and Intrinsic Duality

Shapelet-based explanations can be derived in two distinct modes:

  • Intrinsic interpretability: Using a shapelet-based classifier like a Shapelet Transform or Learning Time-Series Shapelets model, where the learned shapelets are the direct basis for classification and attribution is native.
  • Post-hoc model-agnostic: Applying shapelet discovery algorithms to the training data of a black-box model and then using the discovered shapelets as probes to explain the model's decision boundaries via perturbation or distance-based surrogates. This dual nature allows the technique to be applied to both inherently transparent and opaque temporal models.
05

Computational Discovery via Optimization

Modern shapelet attribution relies on efficient discovery algorithms that have evolved beyond brute-force search:

  • Gradient-based learning: Methods like Learning Time-Series Shapelets (LTS) treat shapelets as learnable parameters, optimizing their shape directly via stochastic gradient descent to minimize a classification loss.
  • Randomized search: Scalable approaches use random projection and pruning to find candidate shapelets in sub-linear time.
  • Shapelet transform: A pipeline that extracts the best-matching distances to a set of candidate shapelets as a feature representation, which can then be fed to any classifier with built-in feature importance methods. This optimization focus makes the technique viable for large-scale, high-frequency time-series data.
06

Distance-Based Attribution Score

The final attribution score for a time step is a function of the distance profile between the shapelet and the input. The core metric is: Attribution(t) = f( min_dist(shapelet, X[t:t+L]) ) Where f is typically an exponential decay or a thresholded indicator function. This creates a non-linear importance curve that peaks at the center of the best-matching subsequence and decays rapidly. The sharp localization prevents attribution smearing—a common problem where importance bleeds into adjacent, irrelevant time steps due to temporal correlation.

SHAPELET ATTRIBUTION

Frequently Asked Questions

Explore the core concepts behind identifying and assigning importance to the discriminative subsequences that drive time-series classifications.

Shapelet attribution is a local, post-hoc interpretability technique that identifies and assigns an importance score to the specific discriminative subsequences—called shapelets—within a time series that are most responsible for a model's classification decision. Unlike generic time-step attribution, it operates on variable-length, phase-independent patterns. The process works by first discovering a set of candidate shapelets that maximize the information gain between classes. For a given prediction, the attribution mechanism measures how the presence, absence, or distortion of each shapelet in the input series influences the model's output probability. This is often achieved by projecting the time series into a shapelet-transformed feature space and then applying a feature attribution method like SHAP or Integrated Gradients to the transformed representation, effectively linking the high-level morphological pattern directly to the model's decision logic.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.