Skip to main content

A pytorch/tensorflow library for generating Cross-Domain saliency maps.

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.

arXiv

Installation

Download this repository:

git clone https://github.com/esl-epfl/cross-domain-saliency-maps

Install using pip:

pip install ./cross_domain_saliency_maps

Examples

Get started with our PyTorch/TensorFlow examples (one-click run)

  1. Pytorch getting started Open In Colab
  2. Tensorflow getting started Open In Colab
  3. What does your model see in your EEG? Open In Colab

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:

  1. Time Domain. This is the original Integrated Gradients, expressing saliency maps in the raw input domain (time). The corresponding Domain object is TimeDomain. The map can be directly generated: timeIG = TimeIG(model, n_iterations, output_channel = 0)

  2. 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 Domain object is FourierDomain. The map can be directly generated: fourierIG = FourierIG(model, n_iterations, output_channel = 0)

  3. 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 by ICADomain. Before generating the map a FastICA needs 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:

  1. Creating the propert Domain object describing the corresponding transform. Domain objects need to inherit from DomainBase and implement the required functions. More details can be found in the implementation of the FourierDomain and ICADomain ( tensorflow, pytorch).

  2. Calling CrossDomainIG with the new domain as the input. This can be done either by creating a CrossDomainIG, initializing it with the new domain, or by implementing a new dedicated class inheriting CrossDomainIG. For more details check the implementations of FourierIG and ICAIG( 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

cross_domain_saliency_maps-0.0.4.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cross_domain_saliency_maps-0.0.4-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

Details for the file cross_domain_saliency_maps-0.0.4.tar.gz.

File metadata

File hashes

Hashes for cross_domain_saliency_maps-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9c9f0e92fc13d39d94aa965483f0b481886b12d6172321ca7a7c190e72af9cfd
MD5 52d687d2d49c783b4369332de35644cd
BLAKE2b-256 1af2a5691fde9e50cd332bc801742a78f0a01d70cf5c4219e63bbb0f50d5e9ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for cross_domain_saliency_maps-0.0.4.tar.gz:

Publisher: python-publish.yml on esl-epfl/cross-domain-saliency-maps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cross_domain_saliency_maps-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for cross_domain_saliency_maps-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d145f59861982672aa27adfc114a05d4da99ad8482a807192c833faa043bea77
MD5 8be6cf74c8bb48eaec6feaf90e824202
BLAKE2b-256 d32dab25f584091a71447c0bfa194d4d4eb1cb2a0cc4274719ff3853e883d6d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cross_domain_saliency_maps-0.0.4-py3-none-any.whl:

Publisher: python-publish.yml on esl-epfl/cross-domain-saliency-maps

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page