Generating Counterfactual Explanations Under Temporal Constraints
Andrei Buliga, Chiara Di Francescomarino, Chiara Ghidini, Marco Montali, Massimiliano Ronzani
TL;DR
This paper tackles the challenge of generating counterfactual explanations for temporal process traces by enforcing background temporal knowledge expressed in $LTL_p$ within a genetic algorithm. It introduces temporal knowledge-aware crossover and mutation operators that, guided by a precomputed DFA $A_oldsymbol{ m \varphi}$, guarantee that generated counterfactual traces satisfy the temporal constraints by design. The fitness function combines standard counterfactual objectives (validity, proximity, sparsity, plausibility, diversity) with a new compliance term, enabling simultaneous optimization for outcome flip and background-consistency. Empirical results on real-world and synthetic process mining datasets show that the proposed approach yields temporally meaningful, compliant, and high-quality counterfactuals with favorable runtime characteristics, outperforming baseline GA and a mutate-and-retry strategy at higher coverage levels. This work enables reliable, interpretable explanations for temporal processes, with potential impact on predictive process monitoring and decision-support in domains where temporal feasibility is essential.
Abstract
Counterfactual explanations are one of the prominent eXplainable Artificial Intelligence (XAI) techniques, and suggest changes to input data that could alter predictions, leading to more favourable outcomes. Existing counterfactual methods do not readily apply to temporal domains, such as that of process mining, where data take the form of traces of activities that must obey to temporal background knowledge expressing which dynamics are possible and which not. Specifically, counterfactuals generated off-the-shelf may violate the background knowledge, leading to inconsistent explanations. This work tackles this challenge by introducing a novel approach for generating temporally constrained counterfactuals, guaranteed to comply by design with background knowledge expressed in Linear Temporal Logic on process traces (LTLp). We do so by infusing automata-theoretic techniques for LTLp inside a genetic algorithm for counterfactual generation. The empirical evaluation shows that the generated counterfactuals are temporally meaningful and more interpretable for applications involving temporal dependencies.
