xaitimesynth
A Python package for benchmarking explainable AI (XAI) algorithms (mostly feature attributions) on time series classification tasks using synthetic data with known ground truth feature locations.
Why xaitimesynth?
Evaluating XAI methods for time series is challenging because we rarely know which time points truly matter for classification. xaitimesynth solves this by generating synthetic data where you control exactly where the class-discriminating features are located.
Each synthetic time series follows a simple additive model: x = background + feature, where the feature is placed at a known window. This lets you directly measure whether attribution methods correctly identify the important time points.
Key Features
- Known ground truth: Feature locations are tracked internally, enabling direct evaluation of attribution correctness
- Flexible data generation: Combine signals (random walks, seasonal patterns, noise) with localized features (peaks, level shifts, pulses)
- Univariate and multivariate: Generate single-channel or multi-channel time series
- Fluent builder API: Chain methods to define complex datasets concisely
- YAML configuration: Define datasets in config files for reproducibility
- Built-in metrics: AUC-PR, AUC-ROC, Relevance Mass Accuracy, Relevance Rank Accuracy, and more
Installation
pip install xaitimesynth
Quick Start
from xaitimesynth import TimeSeriesBuilder, gaussian_noise, gaussian_pulse, seasonal
from xaitimesynth.metrics import auc_pr_score, relevance_mass_accuracy
import numpy as np
# define dataset structure once
base_builder = (
TimeSeriesBuilder(n_timesteps=100, normalization="zscore")
.for_class(0)
.add_signal(gaussian_noise(sigma=1.0))
.add_feature(gaussian_pulse(amplitude=3.0), random_location=True, length_pct=0.3)
.for_class(1)
.add_signal(gaussian_noise(sigma=1.0))
.add_feature(
seasonal(period=10, amplitude=3.0), random_location=True, length_pct=0.3
)
)
# generate train and test sets with different seeds
train = base_builder.clone(n_samples=200, random_state=42).build()
test = base_builder.clone(n_samples=50, random_state=43).build()
# visualise instances from created dataset (by default first observation from each class)
plot = plot_components(train)
plot.show()
# Replace with your XAI method output; shape must be (n_samples, n_dims, n_timesteps)
attributions = np.random.rand(*test["X"].shape)
# Evaluate against ground truth feature locations
auc = auc_pr_score(attributions, test, normalize=True)
rma = relevance_mass_accuracy(attributions, test)
Documentation
Full documentation is available at gregorbaer.github.io/xaitimesynth.
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Citation
If you use xaitimesynth in your work, please consider citing:
Baer, G. (2026). xaitimesynth: A Python Package for Evaluating Attribution Methods for Time Series with Synthetic Ground Truth (arXiv:2603.06781). arXiv. https://doi.org/10.48550/arXiv.2603.06781
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for xaitimesynth 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xaitimesynth-0.1.1.tar.gz | 200.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xaitimesynth-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 259.9 kB
Release files / xaitimesynth-0.1.1.tar.gz
| Download URL | xaitimesynth-0.1.1.tar.gz |
|---|---|
| Size | 200.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3bfdf16f1acca36b3ab511b1a5b0c3b948e06553b64ffcf63af222c56fd8e3a
|
|
BLAKE2b-256 checksum How to use checksums |
631f1994dd0cdd096b272463dd21a62abd01ac25683e3e73b99376e39df35121
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.
Transparency logRelease files / xaitimesynth-0.1.1-py3-none-any.whl
| Download URL | xaitimesynth-0.1.1-py3-none-any.whl |
|---|---|
| Size | 59.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21218d71eb8aa79e839860615907062a65828c7677463d9f5057dc0f14a62621
|
|
BLAKE2b-256 checksum How to use checksums |
eafc200bb21496f1d0a3ac006a0be73efad88ed6336d5979fe9a9ef215c0e160
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 10, 2026.
Transparency log