tsCaptum - A library for univariate and multivariate time series explanation
tsCaptum is a library that adapts the popular post-hoc attribution methods implemented in the Captum framework to work with time series. Unlike previous libraries tsCaptum is :
- Fully compatible with scikit-learn and popular time-series frameworks such as aeon and sktime (e.g., so it is easy to combine ROCKET with SHAP).
- Takes advantage of TS locality by using time series segmentation (so SHAP runs fast with long time series and suffers less from vanishing attribution weights)
- It's extremely easy to use requiring almost no effort by the users
from aeon.classification.convolution_based import RocketClassifier
clf = RocketClassifier(n_jobs=-1)
clf.fit(MP_X_train,MP_y_train)
from tsCaptum.explainers import Feature_Ablation
myFA = Feature_Ablation(clf)
exp = myFA.explain(samples=CMJ_X_test_samples, labels=CMJ_y_test_samples, n_segments=10, normalise=False, baseline=0)
from tsCaptum.explainers import Shapley_Value_Sampling as SHAP
mySHAP = SHAP(clf)
exp = mySHAP.explain(CMJ_X_test_samples, labels=CMJ_y_test_samples, n_segments=10, normalise=False, baseline=0)
More examples can be found in the examples_tscaptum notebook with detailed steps for training, prediction and explanation. Some of the attribution methods available in captum have been described and quantitatively evaluated for time series explanation in our recent ECMLPKDD 2024 paper.
Installation using pip
pip install tsCaptum
In case you have problems installing torch (e.g. you use Linux as OS and you want a lighter installation) use
pip install torch --index-url https://download.pytorch.org/whl/cpu && pip install tsCaptum
Citation
In case you use this library please cite:
@misc{tsCaptum,
author = {Davide Italo Serramazza, Thach Le Nguyen, Georgiana Ifrim},
title = {A Short Tutorial for Multivariate Time Series Explanation using tsCaptum},
journal = {Software Impacts},
year = {2024},
publisher = {Elsevier},
note = {In Press},
url = { https://github.com/mlgig/tscaptum},
}
Metadata
Release files for tsCaptum 0.0.8
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 |
|---|---|---|---|---|
| tscaptum-0.0.8.tar.gz | 10.4 kB | Without provenance | Details for tscaptum-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tscaptum-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for tscaptum-0.0.8-py3-none-any.whl |
Total release size: 21.2 kB
Release files / tscaptum-0.0.8.tar.gz
| Download URL | tscaptum-0.0.8.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d38635bb390ea8cb22bcf24c92327a9aa4d0ac77ff7ac0d6b07e5fbf3b9225f6
|
|
BLAKE2b-256 checksum How to use checksums |
315ae9b92343d545fdd63ac7b4c5933aa8f9d2f70354e26b2c59b0a6e4be4cdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / tscaptum-0.0.8-py3-none-any.whl
| Download URL | tscaptum-0.0.8-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e61488bb9b7e53abca175ecb6bb7c558942d3543af2a466994fe150b58072e83
|
|
BLAKE2b-256 checksum How to use checksums |
5ed703e408397260e1c11be009c1a6ac77c152b56eba8c9bde788eba145d68d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for tsCaptum 0.0.8
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.