SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.13935 · NeurIPS · 2023

Detecting Hidden Confounding In Observational Data Using Multiple Environments

Rickard Karlsson, Jesse Krijthe

arXiv · PDF · Open in the Atlas

Code that ran

4 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 4 no recorded run), measured 2026-11-23; 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/2205.13935.json · badge: /api/ran/2205.13935.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
rickardkarl/detect-hidden-confounding canonical (classifier label)
classifier basis: classifier_2025
4 ran · 4 no recorded run
FunctionStatusWhere it lives
calibrate_tci_gamma_approximation Ran
ran; our contract draft was wrong, not the code
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("72d54d052e82249d")
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 rv_continuous_frozen. 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 numpy as np
from scipy.stats import gamma

# Create small symmetric positive definite matrices for the function parameters
# These represent kernel matrices that need to be symmetric and positive semi-definite

n = 4  # Small size for testing

# Create a small positive definite matrix for mat_tilde_Kddotx_given_z
# Start with a random matrix and make it symmetric positive definite
A1 = np.random.randn(n, n)
mat_tilde_Kddotx_given_z = A1 @ A1.T + np.eye(n) * 0.1  # Ensure positive definiteness

# Create a small positive definite matrix for mat_tilde_Ky_given_z
A2 = np.random.randn(n, n)
mat_tilde_Ky_given_z = A2 @ A2.T + np.eye(n) * 0.1  # Ensure positive definiteness

ARGS = {
    'mat_tilde_Kddotx_given_z': mat_tilde_Kddotx_given_z,
    'mat_tilde_Ky_given_z': mat_tilde_Ky_given_z,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type rv_continuous_frozen — a rv_continuous_frozen output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a rv_continuous_frozen 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
compute_mat_tilde_W Ran
ran, honoured the contract we drafted
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("a271df6d824a6ade")
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 ndarray, ndim 2, dtype family float, shape (9, 3) 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 numpy as np

# Create two symmetric positive semi-definite matrices
# mat_tilde_Kddotx_given_z: represents a kernel matrix, shape (n, n)
# mat_tilde_Ky_given_z: represents another kernel matrix, shape (n, n)

n = 3

# Create a symmetric positive semi-definite matrix for mat_tilde_Kddotx_given_z
# by creating a random matrix and multiplying by its transpose
A = np.random.randn(n, n)
mat_tilde_Kddotx_given_z = A @ A.T
mat_tilde_Kddotx_given_z = (mat_tilde_Kddotx_given_z + mat_tilde_Kddotx_given_z.T) / 2

# Create a symmetric positive semi-definite matrix for mat_tilde_Ky_given_z
B = np.random.randn(n, n)
mat_tilde_Ky_given_z = B @ B.T
mat_tilde_Ky_given_z = (mat_tilde_Ky_given_z + mat_tilde_Ky_given_z.T) / 2

ARGS = {
    "mat_tilde_Kddotx_given_z": mat_tilde_Kddotx_given_z,
    "mat_tilde_Ky_given_z": mat_tilde_Ky_given_z,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (9, 3) — shape (9, 3) 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
compute_tci Ran
ran; our contract draft was wrong, not the code
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("8ca076ec5a1ec815")
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 dict. 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 numpy as np

class KernelWrapper:
    """Stand-in KernelWrapper that computes a simple Gram matrix."""
    def compute_kernelised_gram_matrix(self, data):
        """
        Computes a kernelised Gram matrix.
        For simplicity, we use a linear kernel: K = data @ data.T
        """
        return data @ data.T

# Set random seed for reproducibility
np.random.seed(0)

# Create small sample data
n_samples = 5
dim_x = 3
dim_y = 4
dim_z = 2

data_x = np.random.randn(n_samples, dim_x).astype(np.float64)
data_y = np.random.randn(n_samples, dim_y).astype(np.float64)
data_z = np.random.randn(n_samples, dim_z).astype(np.float64)

# Create kernel wrappers
kernel_kx = KernelWrapper()
kernel_ky = KernelWrapper()
kernel_kz = KernelWrapper()

# Set regularization parameter
epsilon = 0.1

ARGS = {
    'data_x': data_x,
    'data_y': data_y,
    'data_z': data_z,
    'kernel_kx': kernel_kx,
    'kernel_ky': kernel_ky,
    'kernel_kz': kernel_kz,
    'epsilon': epsilon,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
perform_monte_carlo_kcit Ran
ran; our contract draft was wrong, not the code
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("f3c04d2bd7699458")
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 dict. 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 numpy as np
from scipy.stats import gamma, chi2


class KernelWrapper:
    """Minimal kernel wrapper for testing."""
    
    def __init__(self, name="rbf"):
        self.name = name
    
    def compute_kernelised_gram_matrix(self, data):
        """Compute a simple gram matrix for testing."""
        n = data.shape[0]
        # Simple RBF-like kernel: exp(-||x_i - x_j||^2)
        gram = np.zeros((n, n))
        for i in range(n):
            for j in range(n):
                diff = np.linalg.norm(data[i] - data[j])
                gram[i, j] = np.exp(-diff**2)
        return gram


np.random.seed(0)

# Create small test data
n_samples = 5
n_features_x = 2
n_features_y = 2
n_features_z = 3

data_x = np.random.randn(n_samples, n_features_x)
data_y = np.random.randn(n_samples, n_features_y)
data_z = np.random.randn(n_samples, n_features_z)

# Create kernel objects
kernel_kx = KernelWrapper("rbf")
kernel_ky = KernelWrapper("rbf")
kernel_kz = KernelWrapper("rbf")

# Parameters
epsilon = 0.1
test_level = 0.05
nb_simulations = 100

ARGS = {
    'data_x': data_x,
    'data_y': data_y,
    'data_z': data_z,
    'kernel_kx': kernel_kx,
    'kernel_ky': kernel_ky,
    'kernel_kz': kernel_kz,
    'epsilon': epsilon,
    'test_level': test_level,
    'nb_simulations': nb_simulations
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
ImplementedKCITSchemes Not yet run
unverified (harvested, no recorded run)
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("6815723451ef4e08")
How it ran

no invocation recorded.

KCITTestingSchemeNotImplemented Not yet run
unverified (harvested, no recorded run)
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("4e3d817c425c8f6b")
How it ran

no invocation recorded.

perform_gamma_approximation_kcit Not yet run
unverified (harvested, no recorded run)
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("1bf4b3478fe2c576")
How it ran

no invocation recorded.

perform_kcit Not yet run
unverified (harvested, no recorded run)
rickardkarl/detect-hidden-confounding/algorithm/kernel/kcit.py
code served (permissive licence) · get_code("6e88c5ad1f9f482e")
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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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.

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-23.

Repositories linked to this paper

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

Abstract

A common assumption in causal inference from observational data is that there is no hidden confounding. Yet it is, in general, impossible to verify this assumption from a single dataset. Under the assumption of independent causal mechanisms underlying the data-generating process, we demonstrate a way to detect unobserved confounders when having multiple observational datasets coming from different environments. We present a theory for testable conditional independencies that are only absent when there is hidden confounding and examine cases where we violate its assumptions: degenerate & dependent mechanisms, and faithfulness violations. Additionally, we propose a procedure to test these independencies and study its empirical finite-sample behavior using simulation studies and semi-synthetic data based on a real-world dataset. In most cases, the proposed procedure correctly predicts the presence of hidden confounding, particularly when the confounding bias is large. 37th Conference on Neural Information Processing Systems (NeurIPS 2023).

For agents

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

get_harvested_code_for_paper("2205.13935")
get_code_for_paper("2205.13935")
have("2205.13935")

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

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

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

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

Connect an agent — have() is free.