betaFeedback

WorksComputer Science

Conformalized Tree-Based Gradient Ensembles for Out-of-Distribution Detection and Plausible Recourse

Abstract

Counterfactual recourse provides actionable feature adjustments that reverse unfavourable predictions made by automated decision models. However, when recourse search optimizes purely against classifier confidence or narrow proxy scores over gradient-boosted decision trees (GBDT), search procedures can exploit boundary artifacts and low-density regions—an instance of Goodhart's law—yielding out-of-distribution (OOD) recommendations that appear favourable nominally while lacking manifold plausibility. In this paper, we study conformalized OOD gating coupled with actionability-constrained counterfactual search across two tabular benchmarks: Adult and Give Me Some Credit (GMSC). Calibrating finite-sample anomaly gates (gate_IF, gate_LOF, and the conjunctive gate_ALL) at significance level delta = 0.05 over isolation forest, local outlier factor, and k-nearest-neighbor signals, we audit generated counterfactuals against held-out GMM and OCSVM detectors alongside ablation studies (gen10, gen100, and relax). Across matched recourse pairs where both constrained and unconstrained searches succeed, gate_ALL significantly reduces held-out OCSVM flags on Adult (N=541, Delta flag_OCSVM = -0.0296, p_Holm = 4.0e-4) and lowers both held-out flags on GMSC (N=540, Delta flag_OCSVM = -0.0346, p = 1.0751e-4; Delta flag_GMM = -0.1663, p = 3.5679e-16) while increasing matched recourse cost (Delta cost = +0.3035, p = 1.3365e-5) and narrowing overall feasibility. Our findings formalize the cost–feasibility–plausibility trade-off and demonstrate how conformal OOD gating audits recourse reliability on tabular ensembles.

Introduction

Machine learning models deployed in credit underwriting, lending, and socio-economic screening increasingly affect consequential human decisions. Beyond predictive accuracy, stakeholders require post-hoc explanations that are actionable: counterfactual recourse identifies concrete changes to mutable features that move an unfavourable prediction toward a favourable threshold [1, 6, 7].

A central failure mode in counterfactual recourse arises from optimizing purely against a model score or heuristic proxy, which can push candidate states into sparse or out-of-distribution (OOD) regions of feature space [3, 4]. Such counterfactuals may achieve high nominal classification probability while being implausible, fragile, or detached from the underlying data manifold [5, 8].

To examine reliability and plausibility in tabular decision support, three lines of research inform our study:

  • Uncertainty and Plausibility in Recourse: Evaluating predictive reliability and out-of-distribution shifts helps distinguish genuine actionable transitions from sparse or implausible states [1, 6, 7].

  • Structural, Attribution, and Tree-Based OOD Signals: Beyond raw confidence scores, neuron-level relevance attribution (NERO) [2], median gradient statistics under unlabeled wild-data contamination (MEDIX) [3], and tree-embedding pairwise Hamming

distances (TOOD) [4] capture distributional shifts across representations and ensemble partitions.

  • Conformal Calibration: Conformal prediction provides distribution-free, finite-sample threshold calibration with marginal coverage 1−δ1-\delta, mitigating optimistic threshold or metric estimates on finite calibration splits [5, 9, 10, 11].

Furthermore, treating a surrogate score or single proxy as an optimization objective without distributional verification reflects Goodhart’s law [12] and motivates manifold-aware plausibility checks [8]. This paper investigates conformalized OOD gating for constrained counterfactual recourse on GBDT models across Adult [13] and GMSC [14], auditing plausibility transfer to held-out GMM and OCSVM detectors, performing paired Wilcoxon signed-rank tests over matched recourse pairs, and analyzing search-budget and constraint-relaxation ablations (gen10, gen100, and relax).

Related Work

Counterfactual Recourse and Plausibility

Foundational work on counterfactual explanations and actionable recourse established minimal intervention principles and actionability constraints for unfavourable decisions [6, 7]. Subsequent studies highlighted that unconstrained search can yield off-manifold or unrealistic states, motivating plausibility and data-manifold constraints [8] alongside uncertainty and OOD estimation for counterfactual explanations [1]. When search optimizes a single score without plausibility checks, Goodhart’s law [12] can produce high-scoring yet implausible recommendations.

Out-of-Distribution Detection and Structural Signals

Post-hoc OOD detection aims to identify inputs that diverge from the training distribution. Recent methods explore neuron-level relevance (NERO) [2], median gradient statistics under wild-data contamination (Medix) [3], and tree-ensemble partition geometry via average pairwise Hamming distance (TOOD) [4]. For tabular tree ensembles, density and neighborhood anomaly scorers (Isolation Forest, LOF, kk-NN) and generative/margin models (GMM, OCSVM) provide complementary views of feature-space support.

Conformal Prediction and Statistical Calibration

Conformal prediction provides finite-sample calibration and distribution-free marginal validity guarantees under exchangeability [9, 10, 11]. Connecting conformal calibration with OOD detection addresses finite-sample variability in anomaly thresholds and evaluation metrics at significance level δ\delta [5].

Methodology

Actionability-Constrained Recourse Search

Let x∈Xx \in\mathcal{X} denote an unfavourable tabular instance scored by a trained GBDT classifier fθ(x)f_\theta(x) with favourable class probability pθ(y=1∣x)p_\theta(y=1 \mid x). We restrict candidate modifications to an actionable domain A(x)\mathcal{A}(x) enforcing domain rules:

  • Immutability: Non-actionable demographic and historical attributes remain fixed [7].

  • Monotonicity and Spike Protection: Ordered features constrained to non-decreasing shifts respect directionality, and zero-inflated or high-mode-share attributes (such as capital-loss with mode share 0.953 and capital-gain with mode share 0.917 on Adult) are guarded against spurious jumps.

An evolutionary search optimizes candidates x′∈A(x)x' \in\mathcal{A}(x) to cross a target favourable probability threshold τp\tau_p while tracking normalized recourse cost (cumulative feature displacement scaled by training standard deviation), count of modified features (n_chg), and local perturbation stability (robust, measuring prediction consistency under small input perturbations).

Conformalized OOD Gates and Conjunctive Filtering

Let sm(x)s_m(x) be the anomaly score from base detector m∈{IF,LOF,kNN}m \in\{\mathrm{IF},\mathrm{LOF},\mathrm{kNN}\} fitted on training data. Using held-out calibration scores {sm(xical)}i=1ncal\{s_m(x_i^{\mathrm{cal}})\}_{i=1}^{n_{\mathrm{cal}}}, we compute empirical conformal quantile thresholds q^m\hat{q}_m [10, 11, 5] at significance level δ=0.05\delta= 0.05 so that an instance passes gate GmG_m when sm(x)≤q^ms_m(x) \leq\hat{q}_m:

GIF(x)=I(sIF(x)≤q^IF),GLOF(x)=I(sLOF(x)≤q^LOF)(1)G_{\mathrm{IF}}(x) = \mathbb{I}(s_{\mathrm{IF}}(x) \leq\hat{q}_{\mathrm{IF}}), \qquad G_{\mathrm{LOF}}(x) = \mathbb{I}(s_{\mathrm{LOF}}(x) \leq\hat{q}_{\mathrm{LOF}}) \tag*{(1)}
GALL(x)=∏m∈{IF,LOF,kNN}I(sm(x)≤q^m)(2)G_{\mathrm{ALL}}(x) = \prod_{m \in\{\mathrm{IF},\mathrm{LOF},\mathrm{kNN}\}} \mathbb{I}(s_m(x) \leq\hat{q}_m) \tag*{(2)}

Under exchangeability, each individual conformal threshold provides marginal false-alarm control at level δ\delta on in-distribution calibration points, without guaranteeing joint coverage across all three detectors simultaneously or universal OOD detection. Empirically, single-detector gates (gate_IF, gate_LOF) guard against individual anomaly modes, whereas the conjunctive filter gate_ALL enforces simultaneous agreement across all three calibrated scorers.

Held-Out Plausibility Auditing

To prevent circularity (“teaching to the gate”), we audit generated counterfactuals using held-out GMM and OCSVM detectors calibrated at the same δ=0.05\delta= 0.05 level on the calibration split and excluded from search-time gating. Reductions in held-out detector flags indicate plausibility transfer across distinct anomaly formulations [1, 8, 5].

Experimental Setup

We evaluate on two tabular benchmarks: Adult [13] (4,000 evaluation queries across 5 random seeds ×\times 200 unfavourable test instances per seed for each of the 4 gate configurations at target probability τp=0.6\tau_p = 0.6, plus 1,800 evaluation queries across 3 ablation variants) and Give Me Some Credit (GMSC) [14] (6,160 evaluation queries in the main gate benchmark). On Adult, the underlying GBDT classifier is evaluated across disjoint training, calibration-fit, calibration, and test partitions, achieving test Accuracy = 0.8631, Balanced Accuracy = 0.7926, AUROC = 0.9163, and Expected Calibration Error ECE = 0.0351.

We compare unconstrained recourse search (none) against gate_IF, gate_LOF, and gate_ALL. For each configuration, we report:

  • Feasibility and Conditional Recourse Metrics: Feasibility rate (found, fraction of unfavourable queries achieving valid recourse) and conditional means over successful counterfactuals (found = 1) for achieved probability (prob), normalized cost, modified feature count (n_chg), perturbation robustness (robust), and calibrated OOD flag rates (flag_IF, flag_LOF, flag_kNN, flag_GMM, and flag_OCSVM). On Adult, empirical flag rates on real favourable test rows serve as a natural in-distribution reference baseline (IF = 0.071, LOF = 0.044, kNN = 0.064, GMM = 0.079, OCSVM = 0.074).

  • Matched-Pair Statistical Comparisons: Because gating alters which queries succeed, direct differences between conditional table averages can reflect selection effects. We therefore evaluate paired differences (Δ=gate−none\Delta= \text{gate} - \text{none}) strictly on the intersection of queries where both methods succeed (matched pairs: N=541N = 541 for gate_ALL vs. none on Adult; N=540N = 540 on GMSC), reporting two-sided Wilcoxon signed-rank pp-values and Holm-adjusted pp-values (pHolmp_{\mathrm{Holm}}).

Results and Ablations

Main Benchmark Evaluation on Adult and GMSC

Table 1 reports feasibility rates and conditional means across successful counterfactuals for Adult and GMSC. On Adult, gate_ALL lowers conditional held-out flag_OCSVM from 0.1625 (none) to 0.0664 and flag_GMM from 0.0670 to 0.0203—bringing both held-out flag rates below the real favourable test reference (0.074 and 0.079)—while maintaining high robust (0.9151 vs. 0.9012) and reducing found from 0.5970 to 0.5420. On matched pairs (N=541N = 541) on Adult, gate_ALL achieves a statistically significant reduction in held-out OCSVM flags (ΔflagOCSVM=−0.0296\Delta\text{flag}_{\mathrm{OCSVM}} = -0.0296, pHolm=4.0×10−4p_{\mathrm{Holm}} = 4.0 \times10^{-4}) with a modest paired cost increase (Δcost=+0.0536\Delta\text{cost} = +0.0536).

DatasetGatefoundprobcostn_chgrobustIFLOFkNNGMMOCSVM
Adultnone0.59700.62462.85942.38190.90120.09380.08540.13570.06700.1625
Adultgate_IF0.56500.62532.79962.36460.90700.01950.08850.07790.03540.1044
Adultgate_LOF0.59400.62532.86242.40740.90200.08750.02360.12120.06230.1481
Adultgate_ALL0.54200.62592.71852.35980.91510.00370.01850.02030.02030.0664
GMSCnone0.92400.66020.43613.0169—0.83420.47150.41810.56430.1637
GMSCgate_IF0.33830.70000.69153.0921—0.33010.31670.10940.18040.0384
GMSCgate_LOF0.89220.66160.78063.0102—0.83190.04080.29330.50150.1361
GMSCgate_ALL0.31820.70180.75292.9939—0.30000.04290.00610.12650.0082

Table 1. Feasibility rate (found) and conditional mean metrics across successful counterfactuals (found = 1) on Adult and GMSC.

On GMSC, where unconstrained search (none) yields elevated conditional OOD flag rates (flagGMM=0.5643\text{flag}_{\mathrm{GMM}} = 0.5643, flagOCSVM=0.1637\text{flag}_{\mathrm{OCSVM}} = 0.1637), gate_ALL reduces conditional flag OCSVM to 0.0082 and flag_GMM to 0.1265, while increasing conditional cost from 0.4361 to 0.7529 and lowering found from 0.9240 to 0.3182 as implausible candidates are filtered out. Note that under gate_ALL on GMSC, the conditional IF column (0.3000) reflects post-hoc evaluation relative to the reference threshold across retained trajectories and confirms substantial suppression compared to none (0.8342).

Comparison of OOD flag rates across gates relative to real favourable reference baselines

Figure 1. Comparison of OOD flag rates across gates relative to real favourable reference baselines.

Trade-off behavior across gates between feasibility, cost, and distributional plausibility

Figure 2. Trade-off behavior across gates between feasibility, cost, and distributional plausibility.

Paired effect sizes of conformal gates relative to unconstrained recourse (none) on matched recourse pairs

Figure 3. Paired effect sizes of conformal gates relative to unconstrained recourse (none) on matched recourse pairs.

Evaluating strictly on the N=540N = 540 matched recourse pairs on GMSC (where both gate_ALL and none succeed, thus isolating within-query shifts from conditional sample composition), paired Wilcoxon signed-rank tests confirm statistically significant differences: ΔflagOCSVM=−0.0346\Delta\mathrm{flag}_{\mathrm{OCSVM}} = -0.0346 (p=1.0751×10−4p = 1.0751 \times10^{-4}), ΔflagGMM=−0.1663\Delta\mathrm{flag}_{\mathrm{GMM}} = -0.1663 (p=3.5679×10−16p = 3.5679 \times10^{-16}), and Δcost=+0.3035\Delta\mathrm{cost} = +0.3035 (p=1.3365×10−5p = 1.3365 \times10^{-5}).

Ablation Analysis (gen10, gen100, and relax)

Table 2 presents ablation results on Adult (τp=0.6\tau_p = 0.6) comparing gate_IF against none across generation budgets (gen10, gen100) and constraint relaxation (relax). Relaxing constraints (relax) increases found to 0.7233 (gate_IF) and 0.7367 (none) alongside higher n_chg (≈2.93\approx2.93), while gate_IF consistently reduces flag_IF across all settings (achieving a Holm-significant paired reduction ΔflagIF=−0.0415\Delta\mathrm{flag}_{\mathrm{IF}} = -0.0415, pHolm=0.0117p_{\mathrm{Holm}} = 0.0117 across N=217N = 217 matched pairs under relax).

VariantGatefoundprobcostn_chgflag_IFrobust
gen10gate_IF0.48000.62962.88852.34720.02080.9097
gen10none0.50670.62832.97382.36180.09870.9035
gen100gate_IF0.49330.62702.97632.38510.02700.9009
gen100none0.51670.62613.01152.40650.09680.9032
relaxgate_IF0.72330.63262.99352.93550.00920.9217
relaxnone0.73670.63172.99702.92310.06790.9246

Table 2. Ablation results on ADULT (τp=0.6\tau_p = 0.6) comparing gate_IF and none across gen10, gen100, and relax.

Limitations and Conclusion

This evaluation covers ADULT and GMSC with GBDT classifiers and selected density, neighborhood, and generative/margin anomaly detectors calibrated at δ=0.05\delta= 0.05. Because conformal calibration guarantees marginal false-alarm control per detector under exchangeability rather than joint coverage across conjunctive gates, strict filtering reduces recourse feasibility on skewed credit distributions such as GMSC. Future extensions can investigate multi-seed parity on GMSC, broader recourse baselines, and structural or gradient non-conformity signals [2, 3, 4]. Overall, conformalized OOD gating provides a statistically grounded audit against Goodhart vulnerabilities in counterfactual recourse.

References

  1. [1]E. Delaney, D. Greene, and M. T. Keane, “Uncertainty estimation and out-of-distribution detection for counterfactual explanations: Pitfalls and solutions,” arXiv preprint arXiv:2107.09734, 2021 (ICML Workshop on Algorithmic Recourse, July 2021).arxiv.org/abs/2107.09734
  2. [2]A. Chhetri, J. Korhonen, P. Gyawali, and B. Bhattarai, “NERO: Explainable out-of-distribution detection with neuron-level relevance in gastrointestinal imaging,” in Medical Image Computing and Computer Assisted Intervention (MICCAI 2025), Lecture Notes in Computer Science, vol. 15969, pp. 349–359, 2025.
  3. [3]M. Abbas, A. Falahati, H. Goli, and M. Mohammadi Amiri, “Medix: Out-of-distribution detection from unlabeled wild data via robust gradient statistics,” Transactions on Machine Learning Research, 2026 (arXiv:2510.06505).arxiv.org/abs/2510.06505
  4. [4]Z. Shen, M. Wang, G. Cheng, M.-J. Lai, L. Mu, R. Huang, Q. Liu, and H. Zhu, “Tree-based ensemble learning for out-of-distribution detection,” arXiv preprint arXiv:2405.03060, May 2024.arxiv.org/abs/2405.03060
  5. [5]P. Novello, J. Dalmau, and L. Andeol, “Out-of-distribution detection should use conformal prediction (and vice-versa?),” arXiv preprint arXiv:2403.11532, Mar. 2024.arxiv.org/abs/2403.11532
  6. [6]S. Wachter, B. Mittelstadt, and C. Russell, “Counterfactual explanations without opening the black box: Automated decisions and the GDPR,” Harvard Journal of Law & Technology, vol. 31, no. 2, pp. 841–887, 2018.
  7. [7]B. Ustun, A. Spangher, and Y. Liu, “Actionable recourse in linear classification,” in Proc. Conf. Fairness, Accountability, and Transparency (FAT∗), 2019, pp. 10–19.DOI
  8. [8]R. Poyiadzi, K. Sokol, R. Santos-Rodriguez, T. De Bie, and P. A. Flach, “FACE: Feasible and actionable counterfactual explanations,” in Proc. AAAI/ACM Conf. AI, Ethics, and Society (AIES), 2020, pp. 344–350.DOI
  9. [9]V. Vovk, A. Gammerman, and G. Shafer, Algorithmic Learning in a Random World. New York, NY, USA: Springer, 2005.
  10. [10]G. Shafer and V. Vovk, “A tutorial on conformal prediction,” J. Mach. Learn. Res., vol. 9, pp. 371–421, 2008.arxiv.org/abs/0706.3188
  11. [11]A. N. Angelopoulos and S. Bates, “A gentle introduction to conformal prediction and distribution-free uncertainty quantification,” Found. Trends Mach. Learn., vol. 16, no. 4, pp. 494–591, 2023.
  12. [12]C. A. E. Goodhart, “Problems of monetary management: The UK experience,” in Papers in Monetary Economics, vol. 1. Sydney, Australia: Reserve Bank of Australia, 1976.
  13. [13]R. Kohavi, “Scaling up the accuracy of naive-Bayes classifiers: A decision-tree hybrid,” in Proc. 2nd Int. Conf. Knowledge Discovery and Data Mining (KDD), 1996, pp. 202–207.
  14. [14]Kaggle, “Give Me Some Credit,” Kaggle Competition Dataset, 2011. [Online]. Available: https://www.kaggle.com/c/GiveMeSomeCredit

Paper details

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

views · 0

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