Table of Contents
Fetching ...

Optimal Transport on Categorical Data for Counterfactuals using Compositional Data and Dirichlet Transport

Agathe Fernandes Machado, Arthur Charpentier, Ewen Gallic

TL;DR

This paper tackles counterfactual analysis for categorical data by transforming categories into compositional data on the simplex and performing optimal transport directly within this domain. It introduces two parallel routes: (i) a Gaussian mapping in Euclidean coordinates after classical simplex transforms (ALR/CLR/ILR) and (ii) Dirichlet transport with a cost that respects the simplex geometry, enabling a push-forward between measures on $\mathcal{S}_d$. Theoretical results establish the existence and structure of OT maps on the simplex, along with practical matching algorithms and interpolation schemes, and the approach is demonstrated on German Credit and Adult datasets. While offering a principled framework for counterfactuals with categorical data, the paper also notes computational intensity and reliance on well-calibrated probabilistic predictors as key limitations.

Abstract

Recently, optimal transport-based approaches have gained attention for deriving counterfactuals, e.g., to quantify algorithmic discrimination. However, in the general multivariate setting, these methods are often opaque and difficult to interpret. To address this, alternative methodologies have been proposed, using causal graphs combined with iterative quantile regressions (Plečko and Meinshausen (2020)) or sequential transport (Fernandes Machado et al. (2025)) to examine fairness at the individual level, often referred to as ``counterfactual fairness.'' Despite these advancements, transporting categorical variables remains a significant challenge in practical applications with real datasets. In this paper, we propose a novel approach to address this issue. Our method involves (1) converting categorical variables into compositional data and (2) transporting these compositions within the probabilistic simplex of $\mathbb{R}^d$. We demonstrate the applicability and effectiveness of this approach through an illustration on real-world data, and discuss limitations.

Optimal Transport on Categorical Data for Counterfactuals using Compositional Data and Dirichlet Transport

TL;DR

This paper tackles counterfactual analysis for categorical data by transforming categories into compositional data on the simplex and performing optimal transport directly within this domain. It introduces two parallel routes: (i) a Gaussian mapping in Euclidean coordinates after classical simplex transforms (ALR/CLR/ILR) and (ii) Dirichlet transport with a cost that respects the simplex geometry, enabling a push-forward between measures on . Theoretical results establish the existence and structure of OT maps on the simplex, along with practical matching algorithms and interpolation schemes, and the approach is demonstrated on German Credit and Adult datasets. While offering a principled framework for counterfactuals with categorical data, the paper also notes computational intensity and reliance on well-calibrated probabilistic predictors as key limitations.

Abstract

Recently, optimal transport-based approaches have gained attention for deriving counterfactuals, e.g., to quantify algorithmic discrimination. However, in the general multivariate setting, these methods are often opaque and difficult to interpret. To address this, alternative methodologies have been proposed, using causal graphs combined with iterative quantile regressions (Plečko and Meinshausen (2020)) or sequential transport (Fernandes Machado et al. (2025)) to examine fairness at the individual level, often referred to as ``counterfactual fairness.'' Despite these advancements, transporting categorical variables remains a significant challenge in practical applications with real datasets. In this paper, we propose a novel approach to address this issue. Our method involves (1) converting categorical variables into compositional data and (2) transporting these compositions within the probabilistic simplex of . We demonstrate the applicability and effectiveness of this approach through an illustration on real-world data, and discuss limitations.
Paper Structure (20 sections, 28 equations, 8 figures, 1 table, 3 algorithms)

This paper contains 20 sections, 28 equations, 8 figures, 1 table, 3 algorithms.

Figures (8)

  • Figure 1: $n=61$ points in $\mathcal{S}_3$, with a toy dataset.
  • Figure 2: Counterfactuals using the $\operatorname{ilr}$ transformation, and Gaussian optimal transports, $\mu_{\textcolor{red}{0}}\mapsto\mu_{\textcolor{blue}{1}}$ on the left, and $\mu_{\textcolor{blue}{1}}\mapsto\mu_{\textcolor{red}{0}}$ on the right. Below are the averages of $\mathbf{x}_{\textcolor{red}{0},i}$'s and $\mathbf{x}_{\textcolor{blue}{1},i}$'s, and of the transported points. The lines are geodesics in the dual spaces, mapped in the simplex. Optimal transport in $\mathbb{R}^2$, on $\mathbf{z}_{\textcolor{red}{0},i}$'s and $\mathbf{z}_{\textcolor{blue}{1},i}$'s, can be visualized at the bottom (with linear mapping since Gaussian assumptions are made).
  • Figure 3: Densities of Dirchlet distributions in $\mathcal{S}_3$ fitted on observations of the toy dataset of Figure \ref{['fig:ternary1']}.
  • Figure 4: Getting empirical counterfactuals using matching techniques, with $\mathbf{x}_{\textcolor{red}{0},i}$ in red (on the top-left hand-side), and counterfactuals $\mathbf{x}_{\textcolor{blue}{1},j}$'s in blue (bottom-right hand-side), with size proportional to $\mathbf{P}^\star_i=[\mathbf{P}^\star_{i,1},\cdots,\mathbf{P}^\star_{i,n_1}]\in\mathcal{S}_{n_1}$.
  • Figure 5: Optimal transport using the $\operatorname{clr}$ transformation, and Gaussian optimal transports, on the purpose scores in the German Credit database, with two logistic GAM models to predict scores, on top, and below a random forest (left) and a boosting model (right). Points in red are compositions for women, while points in blue are for men. Lines indicate the displacement interpolation when generating counterfactuals.
  • ...and 3 more figures