Time Interpret (tint)
This library expands the captum library with a specific focus on time series. For more details, please see the documentation and our paper.
Install
Time Interpret can be installed with pip:
pip install time_interpret
Please see the documentation for alternative installation modes.
Quick-start
First, let's load an Arma dataset:
from tint.datasets import Arma
arma = Arma()
arma.download() # This method generates the dataset
We then load some test data from the dataset and the corresponding true saliency:
inputs = arma.preprocess()["x"][0]
true_saliency = arma.true_saliency(dim=1)[0]
We can now load an attribution method and use it to compute the saliency:
from tint.attr import TemporalIntegratedGradients
explainer = TemporalIntegratedGradients(arma.get_white_box)
baselines = inputs * 0
attr = explainer.attribute(
inputs,
baselines=baselines,
additional_forward_args=(true_saliency,),
temporal_additional_forward_args=(True,),
).abs()
Finally, we evaluate our method using the true saliency and a white box metric:
from tint.metrics.white_box import aup
print(f"{aup(attr, true_saliency):.4}")
Methods
- AugmentedOcclusion
- BayesKernelShap
- BayesLime
- Discretized Integrated Gradients
- DynaMask
- ExtremalMask
- Fit
- LofKernelShap
- LofLime
- Non-linearities Tunnel
- Occlusion
- Retain
- SequentialIntegratedGradients
- TemporalAugmentedOcclusion
- TemporalOcclusion
- TemporalIntegratedGradients
- TimeForwardTunnel
This package also provides several datasets, models and metrics. Please refer to the documentation for more details.
Paper: Learning Perturbations to Explain Time Series Predictions
The experiments for the paper: Learning Perturbations to Explain Time Series Predictions can be found on these folders:
Paper: Sequential Integrated Gradients: a simple but effective method for explaining language models
The experiments for the paper: Sequential Integrated Gradients: a simple but effective method for explaining language models can be found on the NLP section of the experiments.
TSInterpret
More methods to interpret predictions of time series classifiers have been grouped into TSInterpret, another library with a specific focus on time series. We developed Time Interpret concurrently, not being aware of this library at the time.
Acknowledgment
- Jonathan Crabbe for the DynaMask implementation.
- Sana Tonekaboni for the fit implementation.
- INK Lab for the discretized integrated gradients' implementation.
- Dylan Slack for the BayesLime and BayesShap implementations.
Metadata
Release files for time-interpret 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| time_interpret-0.3.0.tar.gz | 1.5 MB | Without provenance | Details for time_interpret-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| time_interpret-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for time_interpret-0.3.0-py3-none-any.whl |
Total release size: 3.0 MB
Release files / time_interpret-0.3.0.tar.gz
| Download URL | time_interpret-0.3.0.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ff338d7f2400d3302b62a0371e81a88ca7f651e2fb1619327b243059ab7bf72
|
|
BLAKE2b-256 checksum How to use checksums |
af787b7a09aaea24c068ef9c9590515d178b65809492d06641d11823406e1983
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Release files / time_interpret-0.3.0-py3-none-any.whl
| Download URL | time_interpret-0.3.0-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a057001510936e43e31dad4e11c08e6f6d6b22ad687b40186f85df98e3908465
|
|
BLAKE2b-256 checksum How to use checksums |
266fa0684d12c2416eba1ddf140adced066c229850fa04d0fafe8267c0b23f70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.3
|
Security for time-interpret 0.3.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.