SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.06831 · NeurIPS · 2020

Algorithmic recourse under imperfect causal knowledge: a probabilistic approach

Bernhard Schölkopf, Amir-Hossein Karimi, Julius Von Kügelgen, Isabel Valera

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2006.06831.json · badge: /api/ran/2006.06831.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
charmlab/recourse community
Papers with Code archive
4 ran · 0 no recorded run
amirhk/recourse alias (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
FunctionStatusWhere it lives
Decoder Ran
ran on a synthesized input · constructed an object; no result was computed
amirhk/recourse/_cvae/models.py
code served (permissive licence) · get_code("0ce75abe329b58fb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Decoder: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'layer_sizes': [8, 16, 6],
    'latent_size': 4,
    'conditional': True,
    'attr_type': True,
    'num_labels': 3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Decoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Decoder output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
amirhk/recourse/_cvae/models.py
code served (permissive licence) · get_code("987b83e8ed8e2f15")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Encoder: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define arguments for Encoder.__init__
layer_sizes = [4, 8, 16, 32]  # Input 4, hidden layers 8, 16, output 32
latent_size = 5
conditional = True
attr_type = "continuous"
num_labels = 3

ARGS = {
    "layer_sizes": layer_sizes,
    "latent_size": latent_size,
    "conditional": conditional,
    "attr_type": attr_type,
    "num_labels": num_labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Encoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Encoder output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
VAE Ran
ran on a synthesized input · constructed an object; no result was computed
amirhk/recourse/_cvae/models.py
code served (permissive licence) · get_code("80322e379aa11111")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, VAE: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define the init_weights function that's used by Encoder and Decoder
def init_weights(m):
    if type(m) == nn.Linear:
        torch.nn.init.xavier_uniform_(m.weight)
        m.bias.data.fill_(0.01)

# Create VAE with reasonable parameters
encoder_layer_sizes = [10, 8]  # Input 10, hidden 8
latent_size = 4
decoder_layer_sizes = [8, 10]  # Hidden 8, output 10
conditional = True
attr_type = False
num_labels = 3

ARGS = {
    'encoder_layer_sizes': encoder_layer_sizes,
    'latent_size': latent_size,
    'decoder_layer_sizes': decoder_layer_sizes,
    'conditional': conditional,
    'attr_type': attr_type,
    'num_labels': num_labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type VAE — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VAE output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_predictive_distribution Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
charmlab/recourse/gpHelper.py
code served (permissive licence) · get_code("0987ef7bac936b5c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for the function parameters
N = 4  # dimension of inverse covariance matrix
batch_size = 2  # number of training instances

# pred_mean: prediction mean (scalar or small tensor)
pred_mean = torch.tensor(0.5)

# pred_var: prediction variance (scalar or small tensor)
pred_var = torch.tensor(0.3)

# noise_var: noise variance (scalar)
noise_var = torch.tensor(0.1)

# inv_cov: inverse covariance matrix (N x N)
inv_cov = torch.randn(N, N)

# Y_train: training targets (N x 1 or N,)
Y_train = torch.randn(N, 1)

# factual_instance: index into the training set
factual_instance = 0

# Test both distribution types
ARGS = {
    'pred_mean': pred_mean,
    'pred_var': pred_var,
    'noise_var': noise_var,
    'distribution_type': 'iv',
    'inv_cov': inv_cov,
    'Y_train': Y_train,
    'factual_instance': factual_instance
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
noise_posterior_covariance Ran
ran; our contract draft was wrong, not the code
charmlab/recourse/gpHelper.py
code served (permissive licence) · get_code("0a6ed0439bcc2607")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# noise_var: a scalar noise variance value
noise_var = 0.1

# inv_cov: inverse covariance matrix, shape (N, N)
# The function uses inv_cov.shape[0] to get N, and performs matrix operations
# Creating a small 4x4 inverse covariance matrix
N = 4
inv_cov = torch.randn(N, N)
# Make it symmetric positive definite for realism
inv_cov = inv_cov @ inv_cov.T

ARGS = {
    "noise_var": noise_var,
    "inv_cov": inv_cov,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (4, 4) — shape (4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
noise_posterior_mean Ran
ran; our contract draft was wrong, not the code
charmlab/recourse/gpHelper.py
code served (permissive licence) · get_code("9cb08d06a3992c0b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (4, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# noise_posterior_mean takes:
# - noise_var: scalar or tensor (used in multiplication)
# - inv_cov: matrix (used in torch.matmul)
# - Y_train: vector or matrix (used in torch.matmul)

# The function does: noise_var * torch.matmul(inv_cov, Y_train)
# So inv_cov @ Y_train must be valid matrix multiplication
# If inv_cov is (d, d) and Y_train is (d, n), result is (d, n)

# Create small distinct dimensions
d = 4  # dimension
n = 2  # batch/output dimension

noise_var = torch.tensor(0.5)

# inv_cov should be square (d, d)
inv_cov = torch.randn(d, d)

# Y_train should be (d, n) to multiply with (d, d) matrix
Y_train = torch.randn(d, n)

ARGS = {
    "noise_var": noise_var,
    "inv_cov": inv_cov,
    "Y_train": Y_train,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (4, 2) — shape (4, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
noise_posterior_variance Ran
ran; our contract draft was wrong, not the code
charmlab/recourse/gpHelper.py
code served (permissive licence) · get_code("5da45468d17e8152")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# noise_posterior_variance calls noise_posterior_covariance which uses:
# - noise_var: a scalar (used in multiplication)
# - inv_cov: a 2D tensor (used with torch.eye and matrix operations)
# The function computes: noise_var * (torch.eye(N) - noise_var * inv_cov)
# Then extracts diagonal with torch.diag()

N = 4
noise_var = torch.tensor(0.1)
inv_cov = torch.randn(N, N)

ARGS = {
    "noise_var": noise_var,
    "inv_cov": inv_cov,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
init_weights Not yet run
unverified (harvested, no recorded run)
amirhk/recourse/_cvae/models.py
code served (permissive licence) · get_code("f2c0ab428a1c55cf")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
init_weights
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2212.02003 (2022-12)
Bayesian Learning with Information Gain Provably Bounds Risk for a Robust Adversarial Defense

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Recent work has discussed the limitations of counterfactual explanations to recommend actions for algorithmic recourse, and argued for the need of taking causal relationships between features into consideration. Unfortunately, in practice, the true underlying structural causal model is generally unknown. In this work, we first show that it is impossible to guarantee recourse without access to the true structural equations. To address this limitation, we propose two probabilistic approaches to select optimal actions that achieve recourse with high probability given limited causal knowledge (e.g., only the causal graph). The first captures uncertainty over structural equations under additive Gaussian noise, and uses Bayesian model averaging to estimate the counterfactual distribution. The second removes any assumptions on the structural equations by instead computing the average effect of recourse actions on individuals similar to the person who seeks recourse, leading to a novel subpopulation-based interventional notion of recourse. We then derive a gradient-based procedure for selecting optimal recourse actions, and empirically show that the proposed approaches lead to more reliable recommendations under imperfect causal knowledge than non-probabilistic baselines.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2006.06831")
get_code_for_paper("2006.06831")
have("2006.06831")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2006.06831.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2006.06831.svg)](https://syntology.ai/paper/2006.06831)

Connect an agent — have() is free.