P2ExNet: Patch-based Prototype Explanation Network

Dominique Mercier, Andreas Dengel, Sheraz Ahmed · DOI

This post summarizes the paper "P2ExNet: Patch-based Prototype Explanation Network" by Dominique Mercier, Andreas Dengel, and Sheraz Ahmed.

TL;DR

P2ExNet is a deep learning architecture for time-series classification that is "interpretable by design." By using a novel loss function and a prototype-based architecture, it explains its decisions by identifying representative patches of data, achieving accuracy comparable to "black-box" models while providing human-traceable reasoning.

What Problem Does This Paper Address?

Deep learning has revolutionized time-series analysis in fields like medicine and finance, but these models are notoriously "black boxes." While we can see the final prediction, we rarely understand why the model made it.

Existing Explainable AI (XAI) methods face two major hurdles:

  1. Modality Gap: Most XAI research focuses on images (e.g., heatmaps showing which pixels matter). Time-series data is more abstract and harder for humans to interpret visually.
  2. Post-hoc Limitations: Many methods are "post-hoc," meaning they try to explain a pre-trained model. These explanations can be inconsistent, subjective, or fail to capture the model's global logic.

P2ExNet addresses these by creating an intrinsic explanation method. Instead of guessing why a model worked after the fact, P2ExNet is built to reason like a human: by comparing new data to a set of learned, representative "concepts" or prototypes.

Methods

The authors propose a hybrid architecture that combines feature extraction with a case-based reasoning layer.

The Architecture

The workflow (illustrated in Figure 1) consists of three main components:

  • Autoencoder: A standard convolutional encoder maps the input time-series into a latent representation ($h$). A decoder is used during training to ensure this representation preserves the original data's essential features.
  • Prototype Layer: This layer contains "patch prototypes"—small, learned segments in the latent space that represent specific patterns characteristic of different classes.
  • Prototype-Weight Layer: This layer learns the importance of each prototype for specific classes and their typical positions within a sequence.

![Fig.

  1. Inference and testing workflow.](/figures/art_66a9abbc2bc04f8ebec9ea9ac410ef51)

The "Patch Loss"

To make this work, the authors introduced a complex multi-part loss function. Beyond standard classification accuracy, it optimizes for:

  • Clustering & Separation: Ensuring prototypes are close to samples of their assigned class and far from others.
  • Diversity: Preventing the model from learning redundant prototypes.
  • Reconstruction: Keeping the latent space "grounded" in the original data format.

Datasets

The model was evaluated on eight publicly available datasets:

  • UCR Time Series Repository: Seven diverse datasets including Adiac (image-derived shapes), 50words (handwriting), FordA (engine noise), and Electric Devices.
  • Point Anomaly Dataset: A specialized dataset for detecting outliers in time-series.

These datasets vary significantly in sequence length (8 to 500 time-steps), number of channels (1 to 3), and number of classes (2 to 37).

Key Insights and Ideas

  • Patch-based vs. Global Prototypes: Unlike previous work that used one prototype for an entire sequence, P2ExNet uses "patches." This allows the model to say, "This specific dip in the signal looks like a known pattern for Class A," which is much more granular and useful for domain experts.
  • Invertibility is Key: Because the prototypes exist in the latent space of an autoencoder, they can be "decoded" back into the original data space. This allows researchers to actually see the prototypical signal the model is looking for (see Figure 6).
  • Human-Centric Reasoning: The model mimics the human cognitive process of "prototypical knowledge"—mapping new experiences to abstract concepts we already understand.

![Fig.

  1. Prototype comparison between representative samples and decoded latent prototypes.](/figures/art_8c0e3a9d5dce49da97d0f09ebdaa2846)

Key Results

  • No Accuracy Trade-off: Typically, adding interpretability hurts performance. P2ExNet, however, achieved an average performance increase of 0.03% compared to a standard non-interpretable CNN of the same size. In some cases, like the Devices dataset, accuracy jumped by 7%.
  • Traceable Decisions: The model provides visual evidence for its predictions. Figure 2 shows how the model highlights the specific part of an Adiac sample that drove the classification.
  • Sanity Checks: The authors proved the prototypes were meaningful by replacing parts of the original signal with the model's suggested prototypes. When replaced with the "most similar" prototype, the model's prediction remained stable (often >90% consistency), whereas replacing it with a "different" class prototype caused the prediction to flip.

![Fig.

  1. Adiac dataset prototype explanation showing original, modified, and prototype patches.](/figures/art_93c817eb53f645598fa03ba7c87720b9)

Limitations and Future Work

  • Offset Sensitivity: In some "sensitive" datasets, replacing a real signal with a prototype can introduce small offsets or "jumps" that might confuse the model if not properly scaled.
  • Task Specificity: While highly effective for classification, the authors note that for point anomaly tasks, the alignment of patches is more critical than in general classification.
  • Future Directions: The authors suggest that by removing the class-specific assignment of prototypes, this architecture could be adapted for regression and forecasting tasks, which are currently dominated by black-box models.

Summary updated

BibTeX
@inproceedings{mercier2020p,
  author = {Dominique Mercier and Andreas Dengel and Sheraz Ahmed},
  title = {{P2ExNet: Patch-based Prototype Explanation Network}},
  booktitle = {ICONIP},
  year = {2020},
  doi = {10.1007/978-3-030-63836-8\_27},
}
Figure