Pytorch/Tensorflow package for generating saliency maps for time-series models using Cross-Domain Integrated Gradients.
Project description
Timeseries Saliency Maps: Explaining models across multiple domains
Official Pytorch/Tensorflow implementation of Cross-Domain Saliency Maps. The method does not require any model model retraining or modications.
Installation
Install using pip:
pip install cross-domain-saliency-maps
Examples
Get started with our PyTorch/TensorFlow examples (one-click run)
Usage
The library supports generating saliency maps for any domain which can be formulated as an invertible transformation with a differentiable inverse transformation.
To generate maps expressed in a domain, a corresponding Domain
object needs to be defined. This describes the operations performed
during the forward and inverse transformations.
Implementations for the Frequency and Independent Component Analysis (ICA) transformations are already implemented and can be directly deployed. Additionally, the libraryprovides the flexibility of defining new transformations.
Saliency Maps in the Frequency and ICA domains
The following domains are already implemented and can be directly used to generate saliency maps:
-
Time Domain. This is the original Integrated Gradients, expressing saliency maps in the raw input domain (time). The corresponding
Domainobject isTimeDomain. The map can be directly generated:timeIG = TimeIG(model, n_iterations, output_channel = 0) -
Frequency Domain. Each point in the map corresponds to the importance of the corresponding frquency component. The Fourier transform is used to transform the time-domain to the frequency domain. The corresponding
Domainobject isFourierDomain. The map can be directly generated:fourierIG = FourierIG(model, n_iterations, output_channel = 0) -
Independent Component Domain. Each point in the map corresponds to an independent component (IC) of the ICA decomposition. Any ICA implementation can be used as long as it complies with
sklearn.decomposition.FastICA. The domain is defined byICADomain. Before generating the map aFastICAneeds to be fitted to the input sample (see example). The map can be directly generated:icaIG = ICAIG(model, fastICA, n_iterations, output_channel = 0)
Saliency Maps in any domain
The library supports extending the Cross-domain Integrated Gradients for any invertible domain with a differentiable inverse transform. This requires:
-
Creating the propert
Domainobject describing the corresponding transform.Domainobjects need to inherit fromDomainBaseand implement the required functions. More details can be found in the implementation of theFourierDomainandICADomain( tensorflow, pytorch). -
Calling
CrossDomainIGwith the new domain as the input. This can be done either by creating aCrossDomainIG, initializing it with the new domain, or by implementing a new dedicated class inheritingCrossDomainIG. For more details check the implementations ofFourierIGandICAIG( tensorflow, pytorch).
Reference
BibTeX
@article{kechris2025time,
title={Time series saliency maps: Explaining models across multiple domains},
author={Kechris, Christodoulos and Dan, Jonathan and Atienza, David},
journal={arXiv preprint arXiv:2505.13100},
year={2025}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cross_domain_saliency_maps-0.0.6.tar.gz.
File metadata
- Download URL: cross_domain_saliency_maps-0.0.6.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dee6ce5724581615ede41440d285f08d9de60a27e3ae0ec9cd1684a464d2a77
|
|
| MD5 |
ce42ecae59dfb5c53d4e2dce62692a00
|
|
| BLAKE2b-256 |
43f3795c523385ec07bc28a6db64588c524257c798d37c7a92f7aae413bb53de
|
Provenance
The following attestation bundles were made for cross_domain_saliency_maps-0.0.6.tar.gz:
Publisher:
python-publish.yml on esl-epfl/cross-domain-saliency-maps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cross_domain_saliency_maps-0.0.6.tar.gz -
Subject digest:
2dee6ce5724581615ede41440d285f08d9de60a27e3ae0ec9cd1684a464d2a77 - Sigstore transparency entry: 496474538
- Sigstore integration time:
-
Permalink:
esl-epfl/cross-domain-saliency-maps@95d2169029b514e97e9ee761e719a25c05efc579 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/esl-epfl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@95d2169029b514e97e9ee761e719a25c05efc579 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cross_domain_saliency_maps-0.0.6-py3-none-any.whl.
File metadata
- Download URL: cross_domain_saliency_maps-0.0.6-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbfb6343afdc34997b25324c0856e8563b0e91cd0d05e6fdb19d10a29e42c748
|
|
| MD5 |
25789ec4d7ae83b225f22a6871128da8
|
|
| BLAKE2b-256 |
8816f915c98966ded2ae9e0663f2da259d0a80c0d263f44b99adc766e8983eb8
|
Provenance
The following attestation bundles were made for cross_domain_saliency_maps-0.0.6-py3-none-any.whl:
Publisher:
python-publish.yml on esl-epfl/cross-domain-saliency-maps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cross_domain_saliency_maps-0.0.6-py3-none-any.whl -
Subject digest:
cbfb6343afdc34997b25324c0856e8563b0e91cd0d05e6fdb19d10a29e42c748 - Sigstore transparency entry: 496474555
- Sigstore integration time:
-
Permalink:
esl-epfl/cross-domain-saliency-maps@95d2169029b514e97e9ee761e719a25c05efc579 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/esl-epfl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@95d2169029b514e97e9ee761e719a25c05efc579 -
Trigger Event:
release
-
Statement type: