Counterfactual Explanations for Multivariate Time SeriesΒΆ
CONFETTI is a multi-objective method for generating counterfactual explanations for multivariate time series. It identifies the most influential temporal regions, builds an initial perturbation using the nearest unlike neighbour (NUN), and optimizes it under multiple objectives to produce explanations that are sparse, realistic, and confidence-increasing.
The method is model-agnostic and works with any Keras/Scikit-learn classifier. CONFETTI integrates seamlessly with modern deep learning pipelines and supports optional class activation map (CAM) extraction to guide the perturbation process.
InstallationΒΆ
To install the PyPI release:
pip install confetti-ts
FeaturesΒΆ
π Compatible with Python 3.12+
π― Multi-objective counterfactual generation using NSGA-III
π€ Works with any Keras or scikit-learn multivariate time series classifier
π₯ Optional use of CAMs for feature-weighted perturbations
β‘ Parallelized counterfactual generation
π§ͺ Generates multiple candidate counterfactuals per instance
π§° Built-in utilities for:
π loading and preparing time series datasets
π extracting CAM feature weights
π visualizing generated explanations
LicenseΒΆ
CONFETTI is released under the terms of the MIT License.
Citing CONFETTIΒΆ
If you use CONFETTI in your research, please cite the following paper:
@inproceedings{cetina2026counterfactual,
title={Counterfactual Explainable AI (XAI) Method for Deep Learning-Based Multivariate Time Series Classification},
author={Cetina, Alan Gabriel Paredes and Benguessoum, Kaouther and Lourenco, Raoni and Kubler, Sylvain},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={40},
number={21},
pages={17393--17400},
year={2026}
}