Table of Contents
Fetching ...

HyConEx: Hypernetwork classifier with counterfactual explanations

Patryk Marszałek, Ulvi Movsum-zada, Oleksii Furman, Kamil Książek, Przemysław Spurek, Marek Śmieja

TL;DR

HyConEx addresses the need for interpretable AI on tabular data by introducing a deep hypernetwork classifier that outputs instance-specific predictions and counterfactual explanations in a single forward pass. It combines a hypernetwork that yields a local linear classifier with invertible normalizing flows to model class-conditional densities for plausibility, guiding counterfactuals toward high-density regions. The training objective blends classification loss, counterfactual guidance for all alternative classes, proximity to the original input, and density-based plausibility, enabling efficient generation of valid and plausible counterfactuals. Empirical results across 18 datasets show competitive predictive accuracy and superior counterfactual quality and speed relative to external explainer baselines, highlighting HyConEx as an integrated approach to prediction and explanation for tabular data.

Abstract

In recent years, there has been a growing interest in explainable AI methods. We want not only to make accurate predictions using sophisticated neural networks but also to understand what the model's decision is based on. One of the fundamental levels of interpretability is to provide counterfactual examples explaining the rationale behind the decision and identifying which features, and to what extent, must be modified to alter the model's outcome. To address these requirements, we introduce HyConEx, a classification model based on deep hypernetworks specifically designed for tabular data. Owing to its unique architecture, HyConEx not only provides class predictions but also delivers local interpretations for individual data samples in the form of counterfactual examples that steer a given sample toward an alternative class. While many explainable methods generated counterfactuals for external models, there have been no interpretable classifiers simultaneously producing counterfactual samples so far. HyConEx achieves competitive performance on several metrics assessing classification accuracy and fulfilling the criteria of a proper counterfactual attack. This makes HyConEx a distinctive deep learning model, which combines predictions and explainers as an all-in-one neural network. The code is available at https://github.com/gmum/HyConEx.

HyConEx: Hypernetwork classifier with counterfactual explanations

TL;DR

HyConEx addresses the need for interpretable AI on tabular data by introducing a deep hypernetwork classifier that outputs instance-specific predictions and counterfactual explanations in a single forward pass. It combines a hypernetwork that yields a local linear classifier with invertible normalizing flows to model class-conditional densities for plausibility, guiding counterfactuals toward high-density regions. The training objective blends classification loss, counterfactual guidance for all alternative classes, proximity to the original input, and density-based plausibility, enabling efficient generation of valid and plausible counterfactuals. Empirical results across 18 datasets show competitive predictive accuracy and superior counterfactual quality and speed relative to external explainer baselines, highlighting HyConEx as an integrated approach to prediction and explanation for tabular data.

Abstract

In recent years, there has been a growing interest in explainable AI methods. We want not only to make accurate predictions using sophisticated neural networks but also to understand what the model's decision is based on. One of the fundamental levels of interpretability is to provide counterfactual examples explaining the rationale behind the decision and identifying which features, and to what extent, must be modified to alter the model's outcome. To address these requirements, we introduce HyConEx, a classification model based on deep hypernetworks specifically designed for tabular data. Owing to its unique architecture, HyConEx not only provides class predictions but also delivers local interpretations for individual data samples in the form of counterfactual examples that steer a given sample toward an alternative class. While many explainable methods generated counterfactuals for external models, there have been no interpretable classifiers simultaneously producing counterfactual samples so far. HyConEx achieves competitive performance on several metrics assessing classification accuracy and fulfilling the criteria of a proper counterfactual attack. This makes HyConEx a distinctive deep learning model, which combines predictions and explainers as an all-in-one neural network. The code is available at https://github.com/gmum/HyConEx.

Paper Structure

This paper contains 19 sections, 9 equations, 3 figures, 5 tables.

Figures (3)

  • Figure 1: Comparison of HyConEx with related explanability methods. Feature attribution methods, like LIME or SHAP, deliver static explanations supporting only current decision. External methods for generating counterfactual examples, eg. PPCEF or CEGP, typically perform time-consuming optimization for every input data point. HyConEx enclose predictions and counterfactuals in a single method, which makes it extremely efficient method that delivers dynamic explanation.
  • Figure 2: Illustration of all elements of our cost function: (a) Cross-entropy is applied only to the input example similar to IMN kadra2024interpretable. As we can see, the normal vector $w$ is turned into the target class, but the translation of $x'=x-w$ does not lead to the change of class label; (b) We additionally apply the cross-entropy to the counterfactual example. In this case, we produce strong modification, which does not lead to in-distribution samples; (c) We supply the previous loss with the proximity between input and counterfactual. We observe that the model gives the smallest modification, which changes the class label. (d) Complete loss with plausibility term. The final HyConEx enforces $x'$ to lie in the manifold of the target class.
  • Figure 3: Illustration of HyConEx architecture. The hypernetwork takes every input together with the estimated data density and returns: (1) local decision boundary, and (2) counterfactual examples for all alternative classes. In consequence, we obtain predictions and counterfactuals in a single forward pass. We emphasize that HyConEx uses a single hypernetwork, which was duplicated here into $n$ models for illustration only.