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.
