SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.09891 · NeurIPS · 2024

Do causal predictors generalize better to new domains?

Moritz Hardt, Vivian Nastl

arXiv · PDF · Open in the Atlas

Code that ran

12 of 12 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; 3 honoured the contract we drafted, 2 violated it and 0 have no contract verdict; 7 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2402.09891.json · badge: /api/ran/2402.09891.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
socialfoundations/causal-features canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
py-why/dodiscover canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
IS_TASK_DG Ran
ran, violated the contract we drafted
socialfoundations/causal-features/experiments_causal/launch_one_experiment.py
pointer only (licence: NOASSERTION) · get_code("4b205fa5034b6cac")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, socialfoundations/causal-features (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

balanced_accuracy_score Ran
ran, honoured the contract we drafted
socialfoundations/causal-features/experiments_causal/metrics.py
pointer only (licence: NOASSERTION) · get_code("c32a1c87fac066b9")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, socialfoundations/causal-features (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

binary_stat_scores_format Ran
ran; our contract draft was wrong, not the code
socialfoundations/causal-features/experiments_causal/metrics.py
pointer only (licence: NOASSERTION) · get_code("332453e98a97f129")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, socialfoundations/causal-features (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

f_divergence_score Ran
ran, honoured the contract we drafted
py-why/dodiscover/dodiscover/ci/kernel_utils.py
code served (permissive licence) · get_code("7ef2910fa357bf57")
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 float32, ndim 0, dtype family float, shape () 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 sample data for the f_divergence_score function
# y_stat_q: samples from distribution Q (variational class)
# y_stat_p: samples from distribution P (joint distribution)

np.random.seed(0)

# Create arrays of different sizes to distinguish dimensions
y_stat_q = np.random.randn(5).astype(np.float32)  # 5 samples from Q
y_stat_p = np.random.randn(7).astype(np.float32)  # 7 samples from P

ARGS = {
    "y_stat_q": y_stat_q,
    "y_stat_p": y_stat_p,
}
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 float32, ndim 0, dtype family float, shape () — shape () 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
generate_knn_in_subspace Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
py-why/dodiscover/dodiscover/ci/monte_carlo.py
code served (permissive licence) · get_code("adc805a8edd55f21")
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 int, shape (5, 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
from sklearn.neighbors import NearestNeighbors
import scipy.spatial

# Create a small sample array for the covariate space
# Shape: (n_samples=5, n_features_z=3)
z_arr = np.random.RandomState(42).randn(5, 3).astype(np.float64)

ARGS = {
    'z_arr': z_arr,
    'method': 'knn',
    'k': 2,
    'n_jobs': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn — 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 int, shape (5, 3) — shape (5, 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
get_dic_experiments_value Ran
ran; our contract draft was wrong, not the code
socialfoundations/causal-features/experiments_causal/plot_experiment.py
pointer only (licence: NOASSERTION) · get_code("48c885404b9c9689")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, socialfoundations/causal-features (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_dic_experiments_value Ran
ran; our contract draft was wrong, not the code
socialfoundations/causal-features/experiments_causal/plot_experiment_arguablycausal_robust.py
pointer only (licence: NOASSERTION) · get_code("c5b10bd8cd459cf0")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, socialfoundations/causal-features (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_dic_experiments_value Ran
ran; our contract draft was wrong, not the code
socialfoundations/causal-features/experiments_causal/plot_experiment_balanced.py
pointer only (licence: NOASSERTION) · get_code("eda5e96ba9a34cd0")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, socialfoundations/causal-features (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_dic_experiments_value_anticausal Ran
ran; our contract draft was wrong, not the code
socialfoundations/causal-features/experiments_causal/plot_experiment_anticausal.py
pointer only (licence: NOASSERTION) · get_code("58bcc6c74ba0ec3f")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, socialfoundations/causal-features (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

kl_divergence_score Ran
ran, honoured the contract we drafted
py-why/dodiscover/dodiscover/ci/kernel_utils.py
code served (permissive licence) · get_code("a371b4ee094ac18d")
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 float64, ndim 0, 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 numpy as np

np.random.seed(0)

# Create sample data for y_stat_q and y_stat_p
# These should be arrays of probability-like values in a reasonable range
# to avoid numerical issues with the log-likelihood ratio computation
y_stat_q = np.array([0.1, 0.2, 0.3, 0.4, 0.5])
y_stat_p = np.array([0.15, 0.25, 0.35, 0.45])

eps = 1e-7

ARGS = {
    "y_stat_q": y_stat_q,
    "y_stat_p": y_stat_p,
    "eps": eps,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
restricted_nbr_permutation Ran
ran; our contract draft was wrong, not the code
py-why/dodiscover/dodiscover/ci/monte_carlo.py
code served (permissive licence) · get_code("3755a6e00fae05ea")
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 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 numpy as np

# Create a small k-nearest neighbors array
# Shape: (n_samples, k) where n_samples=4, k=3
n_samples = 4
k_dims = 3
nbrs = np.array([
    [1, 2, 3],
    [0, 2, 3],
    [1, 0, 3],
    [2, 1, 0]
], dtype=np.int64)

ARGS = {
    "nbrs": nbrs,
    "random_seed": 42
}
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 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
von_neumann_divergence Ran
ran, violated the contract we drafted
py-why/dodiscover/dodiscover/ci/kernel_utils.py
code served (permissive licence) · get_code("e3bf1f934a3c61cd")
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 float64, ndim 0, 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 numpy as np
from scipy.linalg import logm

# Create two small positive semi-definite (PSD) matrices
# PSD matrices can be created as A = Q @ Q.T where Q is any matrix
np.random.seed(0)

# Create first PSD matrix A (4x4)
Q_A = np.random.randn(4, 4)
A = Q_A @ Q_A.T

# Create second PSD matrix B (4x4)
Q_B = np.random.randn(4, 4)
B = Q_B @ Q_B.T

ARGS = {
    "A": A,
    "B": B,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 11 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 11 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-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

We study how well machine learning models trained on causal features generalize across domains. We consider 16 prediction tasks on tabular datasets covering applications in health, employment, education, social benefits, and politics. Each dataset comes with multiple domains, allowing us to test how well a model trained in one domain performs in another. For each prediction task, we select features that have a causal influence on the target of prediction. Our goal is to test the hypothesis that models trained on causal features generalize better across domains. Without exception, we find that predictors using all available features, regardless of causality, have better in-domain and out-of-domain accuracy than predictors using causal features. Moreover, even the absolute drop in accuracy from one domain to the other is no better for causal predictors than for models that use all features. In addition, we show that recent causal machine learning methods for domain generalization do not perform better in our evaluation than standard predictors trained on the set of causal features. Likewise, causal discovery algorithms either fail to run or select causal variables that perform no better than our selection. Extensive robustness checks confirm that our findings are stable under variable misclassification.

For agents

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

get_harvested_code_for_paper("2402.09891")
get_code_for_paper("2402.09891")
have("2402.09891")

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

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

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

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

Connect an agent — have() is free.