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.
Glossary
Shapelet Attribution

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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Shapelet attribution is part of a broader toolkit for temporal model explainability. These related techniques provide complementary approaches for understanding which time steps and patterns drive predictions in sequence models.
Temporal SHAP
Adapts Shapley value calculations from cooperative game theory to assign importance scores to individual time steps. Each time step is treated as a player in a coalition, and its marginal contribution to the prediction is computed across all possible subsets. This provides a axiomatically fair distribution of credit among temporal features, satisfying properties like local accuracy and consistency.
Time-Step Ablation
A perturbation-based method that systematically removes or masks individual time steps from a sequence to measure the resulting change in model output. By observing how the prediction degrades when specific temporal segments are deleted, engineers can rank steps by importance. This technique is model-agnostic and provides a direct, causal measure of reliance on each time point.
Temporal Occlusion Analysis
Slides a masking window across a time series, occluding contiguous segments to generate a saliency map. The resulting heatmap reveals which temporal intervals are most critical for a prediction. Unlike single-step ablation, this method captures the importance of temporal context windows and is particularly effective for identifying discriminative subsequences in long sequences.
Counterfactual Temporal Trajectory
Generates a minimally modified alternative time-series path that would cause the model to produce a different outcome. This technique answers the question: 'What would need to change, and when, to alter this forecast?' It provides actionable recourse by identifying the smallest temporal perturbation required to flip a classification or change a prediction direction.
Temporal Integrated Gradients
Computes the integral of gradients along a straight-line path from a neutral baseline (e.g., zero signal) to the actual input. This satisfies the sensitivity axiom, meaning that if a time step differs from the baseline and influences the output, it receives non-zero attribution. The method is particularly robust for deep temporal convolutional networks.
LSTM Gate Activation Analysis
Visualizes and quantifies the activations of forget, input, and output gates in Long Short-Term Memory networks. By tracking when gates open and close, engineers can explain how information is stored, updated, or discarded at each time step. This provides a mechanistic window into the model's internal memory management during sequence processing.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us