betaFeedback

WorksComputer Science

Probabilistic Counterfactual Inference for Discrete Outcomes in Gaussian-Process Causal Models

Abstract

Counterfactual inference in Gaussian-process structural causal models (GP-SCMs) has been developed primarily for continuous endogenous variables, limiting applicability to causal graphs that contain discrete child nodes with continuous parents. We introduce a unified probabilistic framework for counterfactual inference with heterogeneous variable types by pairing GP predictors with explicit exogenous noise mechanisms. For discrete outcomes, we derive exact conditional noise-abduction procedures using a uniform threshold for binary variables, a Gumbel-max race for nominal categories, and a latent Gaussian cut-point model for ordinal ones. In each case, we propagate abducted noise through interventions while accounting for posterior uncertainty in the GP latent functions, and prove that the resulting mechanisms reproduce the fitted model's observational and interventional distributions. On synthetic SCMs with known ground-truth counterfactuals, we evaluate estimation accuracy, consistency, and robustness to coupling misspecification. A key finding is that applying a categorical coupling to ordinal data inflates counterfactual error roughly threefold even when observational fit remains comparable, and that this error does not diminish with more data. As the training set grows, the fitted structural equation converges to the truth while the counterfactual error flattens onto a floor. In the reverse direction, forcing a false order onto nominal data instead degrades the fitted equation itself. The choice of coupling must therefore be justified on structural grounds rather than read off the fit.

Introduction

Incorporating causality into Machine Learning can be a crucial step towards developing realistic and explainable models. Pearl et al. [ [18] has shown that structural causal models (SCMs) can be used to determine the effects of interventions and estimate counterfactual queries. Interventions compute the downstream effects of changing one or more variables in a system. Counterfactuals extend upon this by using knowledge of a factual instance to compute how the variables would have changed had an intervention been performed.

To incorporate this causal reasoning into a real-world system, researchers must develop an SCM comprised of a causal graph and structural equations. The graph structure describes which features are causal parents of others, which can be determined using domain knowledge and independence tests using observational data [20, 5] (Zhang et al. 2011). For this paper, we assume this step has been completed using one of many graph discovery techniques. From here, structural equations must be fitted for each parent-child relationship. Recent work has suggested that Gaussian process (GP) regression can approximate the variety of relationships that occur (linear, non-linear, additive) and provide uncertainty quantification over the resulting counterfactual [7]. This method has presently only been developed for relationships between real-valued features, and extending it to work for non-continuous child variables requires several adjustments. We explain how the probabilistic counterfactual estimation changes for binary, categorical and ordinal features. Our method is proven theoretically and validated experimentally using synthetic SCMs for ground-truth.

Counterfactuals

We define counterfactuals and their evaluation as in Pearl et al. [2016]:

Counterfactual Queries

Given observation xF\mathbf{x}^{F}, what would have happened if XIX_I had instead taken the value θ\theta? The counterfactual variable is written xCF=x(do⁡(XI=θ))∣xF\mathbf{x}^{\mathrm{CF}} = \mathbf{x}(\operatorname{do}(X_I = \theta)) \mid\mathbf{x}^{F}.

Given a fully specified SCM MM with dd nodes and equations F={Xr:=fr(Xpa⁡(r),Ur)}r=1d\mathbf{F} = \{\mathbf{X}_r := f_r(\mathbf{X}_{\operatorname{pa}(r)}, U_r)\}_{r=1}^{d}, and an observed instance xF\mathbf{x}^{F}, counterfactuals asking what would have happened had we set XI=θX_I = \theta are evaluated using the following three steps:

Three Steps for Computing Counterfactuals

  1. Abduction: Use evidence xF\mathbf{x}^{F} and the equations to solve backwards for {Ur}r=1d\{U_r\}_{r=1}^{d}.

  2. Action: Modify the model MM, by performing the intervention do⁡(XI=θ)\operatorname{do}(X_I = \theta), to get new structural equations Fdo⁡(XI=θ)\mathbf{F}^{\operatorname{do}(X_I=\theta)}.

  3. Prediction: Use the modified structural equations and the values of {Ur}r=1d\{U_r\}_{r=1}^{d} to compute the value of xCF\mathbf{x}^{\mathrm{CF}}.

Typically, the most challenging step in this process is Abduction, because the method to isolate the factual noise depends on the form of the structural equations. The previous approach uses additive Gaussian noise, which allows for easy noise isolation Karimi et al. [2020], however this approach will not work for discrete features.

Consider a bank deciding whether to extend a loan. A continuous feature such as debt-to-income ratio determines an ordinal risk tier (subprime through super-prime, from thresholding a composite score), which in turn determines a nominal decision such as which loan product is offered. An applicant who is denied may reasonably ask what would have happened had their financial position been different. Answering this counterfactual query means carrying Abduction, Action, and Prediction through a causal chain whose structural equations mix continuous, ordinal, and nominal variables. Existing approaches are limited to scenarios with only real-valued downstream variables, leaving systems like the one described here out of their scope Karimi et al. [2020].

Existing Approaches

Prior work falls into three families, by which pipeline stage they address: discovering the graph, fitting equations on a given graph, or coupling a fixed interventional law into a counterfactual mechanism. We address the middle stage: fitting Gaussian Process equations paired with an exact noise-abduction identity. Graph discovery has begun exploiting ordinal structure to orient edges [14], and Yao et al. [2025] use a categorical mechanism close to ours for graph identifiability in mixed additive noise models, without addressing counterfactual queries; we instead take the graph as given. For fitting discrete or ordinal equations, ordinal variables are classically modelled by discretising a latent score at fixed cut-points [13, 2], with Chu and Ghahramani [2005] giving the Gaussian Process likelihood our construction builds on; deep generative alternatives dequantise discrete variables into normalising-flow SCMs [16], or relax categorical latents via a temperature-annealed softmax [6, 12] for gradient-based training rather than exact abduction, which we use instead. A separate line instead couples a fixed interventional law: Oberst and Sontag [2019] introduce the Gumbel-max coupling, singled out axiomatically by counterfactual stability, while Lorberbom et al. [2021] learn a coupling minimising counterfactual treatment-effect variance over a query distribution; our interventional law is itself a fitted, uncertain Gaussian Process, and we choose the coupling to match the endogenous variable’s type, not to optimise a downstream objective.

Preliminaries

Introducing Gumbel Noise

We introduce the Gumbel distribution because it gives an exact, explicit exogenous noise variable for categorical outcomes. The same construction is used to relax categorical sampling into a differentiable operation for gradient-based training via the Gumbel-softmax/Concrete distribution [6, 12]. We instead exploit its exact (non-relaxed) form to obtain closed-form noise abduction.

Gumbel Distribution [4]. G∼Gumbel⁡(μ,1)G \sim\operatorname{Gumbel}(\mu,1) if it has CDF F(g)=exp⁡(−e−(g−μ))F(g) = \exp\left(-e^{-(g-\mu)}\right) on R\mathbb{R}.

We highlight three important properties of this distribution that we will use to evaluate the counterfactuals:

  • Reparameterisation: V∼Uniform⁡(0,1)⟹μ−log⁡(−log⁡V)∼Gumbel⁡(μ,1)V \sim\operatorname{Uniform}(0,1) \Longrightarrow\mu- \log(-\log V) \sim\operatorname{Gumbel}(\mu,1).

  • Truncation [11]: Conditioned on G≤bG \le b,

    μ−log⁡(e−(b−μ)−log⁡V)∼Gumbel⁡(μ,1)\mu- \log\left(e^{-(b-\mu)} - \log V\right) \sim\operatorname{Gumbel}(\mu,1) for V∼Uniform⁡(0,1)V \sim\operatorname{Uniform}(0,1)

    has the conditioned law.

  • Gumbel-max trick [Yellott, 1977]: For scores ℓ∈RC\ell\in\mathbb{R}^{C} and iid G1,…,GC∼Gumbel⁡(0,1)G_1,\ldots,G_C \sim\operatorname{Gumbel}(0,1), the perturbed maximum M:=max⁡c{ℓc+Gc}M := \max_c\{\ell_c + G_c\} satisfies

M∼Gumbel⁡(log⁡∑ceℓc,1)independently of argmax⁡c{ℓc+Gc}∼softmax⁡(ℓ)M \sim\operatorname{Gumbel}\left(\log\sum_c e^{\ell_c},1\right) \quad\text{independently of } \operatorname*{argmax}_c\{\ell_c+G_c\}\sim\operatorname{softmax}(\ell)

Coupling and Abduction

When the structural equations are approximated by fitted GPs, the uncertainty about frf_r means that the exogenous noise driving XrX_r is never observed directly. Instead, its posterior is updated (abducted) from the factual observation, and this fixed abducted noise is carried into the counterfactual world while only the parents change. For continuous nodes as in Karimi et al. [ [7], one can use additive Gaussian noise that can be uniquely solved for given a factual instance.

For a discrete outcome, this uniqueness breaks. The factual and counterfactual class distributions, pFp^F and pCFp^{\mathrm{CF}}, are each pinned down by the fitted model, but they alone do not determine a joint law over the pair (Xr,XrCF)(X_r, X_r^{\mathrm{CF}}): infinitely many joint distributions share the same two marginals. Call any such choice a coupling. Abduction is how a coupling gets realised in practice: we equip XrX_r with an explicit exogenous noise variable, infer its posterior from the factual observation xrFx_r^F, and reuse that same noise, unchanged, to generate XrCFX_r^{\mathrm{CF}} under the counterfactual parents. Because the noise realisation is shared across both worlds, the resulting joint law (the coupling) is determined entirely by how the exogenous noise is defined and abducted, which is exactly the modelling choice this paper studies for each variable type.

  • Binary. A binary outcome needs only a single scalar noise Ur∼Uniform⁡(0,1)U_r \sim\operatorname{Uniform}(0,1), thresholded against the class probability. This is the unique coupling consistent with two Bernoulli marginals under the natural monotonicity requirement that raising the class probability cannot lower P(Xr=1)P(X_r=1).

  • Categorical. For C≥3C \ge3 unordered classes, one natural noise is a vector of CC independent Gumbel perturbations, one per class, abducted jointly from which class won the factual “race” and reused for a second race against the counterfactual class scores. This is the Gumbel-max coupling: it treats every pair of classes symmetrically, and is the coupling characterised by counterfactual stability [15].

  • Ordinal. When the classes carry an order, a different noise construction is more natural: a single shared Gaussian NrN_r, pushed through the factual and counterfactual cutpoints of the same monotone threshold function. This is the comonotone coupling: since the same monotone map is applied to the same noise draw in both worlds, it respects the class ordering in a way the Gumbel-max coupling does not.

The categorical and ordinal constructions therefore abduct genuinely different exogenous noise objects (a vector of per-class Gumbels versus a single Gaussian), and so induce different couplings, even when fit to variables with the same number of classes. The one case where this distinction disappears is C=2C = 2: with only two classes, both constructions collapse to thresholding a single uniform, so the Gumbel-max and comonotone couplings coincide exactly, and the choice between “categorical” and “ordinal” machinery becomes immaterial.

Results

Both propositions below instantiate the Compatibility/Abduction/Action-and-Prediction schema of § 2.2; what differs is the noise object each abducts and how it is reused.

Categorical

Proposition 1 (Categorical Probabilistic Counterfactuals with Gaussian Processes). Let f(x)\mathbf{f}(\mathbf{x}) denote a realisation of the fitted GP latent at Xpa(r)=x\mathbf{X}_{\mathrm{pa}(r)} = \mathbf{x}, and let p(x;f):=(p1(x;f),…,pC(x;f))\mathbf{p}(\mathbf{x};\mathbf{f}) := (p_1(\mathbf{x};\mathbf{f}),\ldots,p_C(\mathbf{x};\mathbf{f})) be the normalised class-probability vector it induces. We fit CC independent binary Laplace GP classifiers, one per class, and renormalise: pc:=σ(fc)/∑c′σ(fc′)p_c := \sigma(f_c)/\sum_{c'} \sigma(f_{c'}). The joint multiclass softmax fit, under which p=softmax⁡(f)\mathbf{p} = \operatorname{softmax}(\mathbf{f}) instead, is developed in §A.6.1, and Remark 2 records what differs between the two; nothing in the construction below depends on the choice, because the coupling is stated on log⁡p\log\mathbf{p} rather than on f\mathbf{f}. Write ℓ(x):=log⁡p(x;f)\boldsymbol{\ell}(\mathbf{x}) := \log\mathbf{p}(\mathbf{x};\mathbf{f}) for the corresponding log-probability scores, suppressing f\mathbf{f} where no ambiguity arises. Model the structural equations as:

Xr:=arg⁡max⁡c∈{1,…,C}{ℓc(Xpa(r))+Gr,c},Gr,c∼iidGumbel⁡(0,1),(1)X_r := \underset{c \in\{1,\ldots,C\}}{\arg\max}\{\ell_c(X_{\mathrm{pa}(r)}) + G_{r,c}\}, \qquad G_{r,c} \overset{\mathrm{iid}}{\sim} \operatorname{Gumbel}(0,1), \tag*{(1)}

with Gr:=(Gr,1,…,Gr,C)\mathbf{G}_r := (G_{r,1},\ldots,G_{r,C}).

(Compatibility.) For every x\mathbf{x} and every realisation of the latent,

P(Xr=c∣Xpa(r)=x,f)=softmax⁡(log⁡p(x;f))c=pc(x;f),(2)P(X_r = c \mid X_{\mathrm{pa}(r)} = \mathbf{x},\mathbf{f}) = \operatorname{softmax}(\log\mathbf{p}(\mathbf{x};\mathbf{f}))_c = p_c(\mathbf{x};\mathbf{f}), \tag*{(2)}

the softmax identity required by the schema above.

(Abduction.) Write ℓF:=ℓ(xpa(r)F;fF)\boldsymbol{\ell}^{F} := \boldsymbol{\ell}(\mathbf{x}^{F}_{\mathrm{pa}(r)};\mathbf{f}^{F}) and let c∗:=xrFc^* := x_r^{F} be the observed class, and M:=max⁡c{ℓcF+Gr,c}M := \max_{c}\{\ell_c^{F} + G_{r,c}\} is the factual winning score. Conditional on ℓF\boldsymbol{\ell}^{F} and on Xr=c∗X_r = c^*, the posterior of Gr\mathbf{G}_r is sampled exactly by

M∼Gumbel⁡(log⁡∑ceℓcF,1),Gr,c∗:=M−ℓc∗F,Gr,c:=−log⁡(e−(M−ℓcF)−log⁡Vc), c≠c∗,(3)M \sim\operatorname{Gumbel}\left(\log\sum_c e^{\ell_c^{F}},1\right), \qquad G_{r,c^*} := M-\ell_{c^*}^{F}, \qquad G_{r,c} := -\log(e^{-(M-\ell_c^{F})}-\log V_c),\ c \ne c^*, \tag*{(3)}

with Vc∼iidUniform⁡(0,1)V_c \overset{\mathrm{iid}}{\sim} \operatorname{Uniform}(0,1).

(Action and Prediction.) The intervention replaces xpa(r)F\mathbf{x}^{F}_{\mathrm{pa}(r)} by x~pa(r)\tilde{\mathbf{x}}_{\mathrm{pa}(r)} leaving the latent process and Gr\mathbf{G}_r fixed, so with ℓ~:=ℓ(x~pa(r))\tilde{\boldsymbol{\ell}} := \boldsymbol{\ell}(\tilde{\mathbf{x}}_{\mathrm{pa}(r)}),

XrCF=arg⁡max⁡c{ℓ~c+Gr,c}.(4)X_r^{\mathrm{CF}} = \underset{c}{\arg\max}\{\tilde{\ell}_c + G_{r,c}\}. \tag*{(4)}

References

  1. [1]Christopher M. Bishop. Pattern Recognition and Machine Learning. Springer, 2006.
  2. [2]Stefan Boes. Nonparametric analysis of treatment effects in ordered response models. Empirical Economics, 44(1):81–109, 2013.
  3. [3]Wei Chu and Zoubin Ghahramani. Gaussian processes for ordinal regression. Journal of Machine Learning Research, 6:1019–1041, 2005.
  4. [4]Emil Julius Gumbel. Statistical Theory of Extreme Values and Some Practical Applications: A Series of Lectures, volume 33 of National Bureau of Standards Applied Mathematics Series. U.S. Government Printing Office, Washington, D.C., 1954.
  5. [5]Patrik O. Hoyer, Dominik Janzing, Joris M. Mooij, Jonas Peters, and Bernhard Schölkopf. Nonlinear causal discovery with additive noise models. In Advances in Neural Information Processing Systems 21 (NeurIPS), pages 689–696, 2009.
  6. [6]Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with Gumbel-softmax. In International Conference on Learning Representations (ICLR), 2017.arxiv.org/abs/1611.01144
  7. [7]Amir-Hossein Karimi, Julius von Kügelgen, Bernhard Schölkopf, and Isabel Valera. Algorithmic recourse under imperfect causal knowledge: A probabilistic approach. In Advances in Neural Information Processing Systems 33 (NeurIPS), pages 265–277, 2020.arxiv.org/abs/2006.06831
  8. [8]Guy Lorberbom, Daniel D. Johnson, Chris J. Maddison, Daniel Tarlow, and Tamir Hazan. Learning generalized Gumbel-max causal mechanisms. In Advances in Neural Information Processing Systems 34 (NeurIPS), 2021.arxiv.org/abs/2111.06888
  9. [9]Chaochao Lu, Biwei Huang, Ke Wang, José Miguel Hernández-Lobato, Kun Zhang, and Bernhard Schölkopf. Sample-efficient reinforcement learning via counterfactual-based data augmentation. arXiv preprint arXiv:2012.09092, 2020.arxiv.org/abs/2012.09092
  10. [10]David J. C. MacKay. The evidence framework applied to classification networks. Neural Computation, 4(5):720–736, 1992.DOI
  11. [11]Chris J. Maddison, Daniel Tarlow, and Tom Minka. A* sampling. In Advances in Neural Information Processing Systems 27 (NeurIPS), pages 3086–3094, 2014.
  12. [12]Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In International Conference on Learning Representations (ICLR), 2017.arxiv.org/abs/1611.00712
  13. [13]Richard D. McKelvey and William Zavoina. A statistical model for the analysis of ordinal level dependent variables. The Journal of Mathematical Sociology, 4(1):103–120, 1975.DOI
  14. [14]Yang Ni and Bani Mallick. Ordinal causal discovery. In Proceedings of the Thirty-Eighth Conference on Uncertainty in Artificial Intelligence (UAI), 2022.arxiv.org/abs/2201.07396
  15. [15]Michael Oberst and David Sontag. Counterfactual off-policy evaluation with Gumbel-max structural causal models. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of PMLR, pages 4881–4890, 2019.arxiv.org/abs/1905.05824
  16. [16]Nick Pawlowski, Daniel C. Castro, and Ben Glocker. Deep structural causal models for tractable counterfactual inference. In Advances in Neural Information Processing Systems 33 (NeurIPS), 2020.arxiv.org/abs/2006.06485
  17. [17]Judea Pearl. Probabilities of causation: three counterfactual interpretations and their identification. Synthese, 121(1):93–149, 1999.
  18. [18]Judea Pearl, Madelyn Glymour, and Nicholas P. Jewell. Causal Inference in Statistics: A Primer. John Wiley & Sons, 2016.
  19. [19]Carl Edward Rasmussen and Christopher K. I. Williams. Gaussian Processes for Machine Learning. MIT Press, Cambridge, MA, 2006.DOI
  20. [20]Peter Spirtes, Clark Glymour, and Richard Scheines. Causation, Prediction, and Search. MIT Press, 2nd edition, 2000.
  21. [21]Christopher K. I. Williams and David Barber. Bayesian classification with Gaussian processes. IEEE Transactions on Pattern Analysis and Machine Intelligence, 20(12):1342–1351, 1998.DOI

Paper details

vlnc:W_4rjxyvr2
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 1

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents