SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1804.05146 · 2018

A comparison of methods for model selection when estimating individual treatment effects

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 0 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/1804.05146.json · badge: /api/ran/1804.05146.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
tonyduan/hte-prediction-rcts community (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
bootstrap_dataset Ran
ran on a synthesized input
tonyduan/hte-prediction-rcts/src/dataloader.py
code served (permissive licence) · get_code("7158f0b5c2fbe552")
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 int, shape (10,) 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

np.random.seed(0)

# Create a small dataset dictionary with the required keys: 'X', 'w', and 'y'
# X: feature matrix (10 samples, 4 features)
# w: treatment assignment (binary: 0 or 1)
# y: outcome (binary: 0 or 1)

n_samples = 10
n_features = 4

X = np.random.randn(n_samples, n_features)
w = np.array([1, 1, 1, 0, 0, 0, 1, 0, 1, 0])  # treatment assignment
y = np.array([1, 0, 1, 1, 0, 0, 1, 0, 1, 1])  # outcome

dataset = {
    'X': X,
    'w': w,
    'y': y
}

ARGS = {
    'dataset': dataset
}
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 int, shape (10,) — shape (10,) 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
bucket_arr Ran
ran on a synthesized input
tonyduan/hte-prediction-rcts/src/evaluate.py
code served (permissive licence) · get_code("db34a7d767a49b30")
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 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 numpy as np

# Construct test data for bucket_arr function
# The function expects:
# - pred_rr: array of predictions (used with > 0 and <= 0 comparisons)
# - y: array of outcome values (used for mean calculations)
# - w: array of treatment/group indicators (0 or 1, used with == comparisons)

np.random.seed(0)

# Create small test arrays
n_samples = 10
pred_rr = np.array([0.5, -0.3, 0.2, -0.1, 0.8, -0.5, 0.1, -0.2, 0.6, -0.4])
y = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0])
w = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])

ARGS = {
    'pred_rr': pred_rr,
    'y': y,
    'w': w
}
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 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
get_range Ran
ran on a synthesized input
tonyduan/hte-prediction-rcts/src/evaluate.py
code served (permissive licence) · get_code("1dcdabe69815a74e")
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 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 numpy as np

# Construct scores - a simple numpy array of random values
# The function uses: np.percentile() and np.mean() on scores
# So scores should be array-like with numerical values
np.random.seed(0)
scores = np.random.randn(100)

ARGS = {
    "scores": scores
}
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 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
load_data Ran
ran on a synthesized input
tonyduan/hte-prediction-rcts/src/dataloader.py
code served (permissive licence) · get_code("80132d634ab80ed9")
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 pandas as pd
import numpy as np
import tempfile
import os

# Create temporary CSV files for sprint and accord datasets
temp_dir = tempfile.mkdtemp()

# Create sprint_cut.csv
sprint_data = {
    'cvd': [0, 1],
    't_cvds': [100, 200],
    'INTENSIVE': [0, 1],
    'feature1': [1.0, 2.0],
    'feature2': [3.0, 4.0],
    'feature3': [5.0, 6.0]
}
sprint_df = pd.DataFrame(sprint_data)
sprint_path = os.path.join(temp_dir, 'sprint_cut.csv')
sprint_df.to_csv(sprint_path, index=False)

# Create accord_cut.csv
accord_data = {
    'cvd': [1, 0],
    't_cvds': [150, 250],
    'INTENSIVE': [1, 0],
    'feature1': [1.5, 2.5],
    'feature2': [3.5, 4.5],
    'feature3': [5.5, 6.5]
}
accord_df = pd.DataFrame(accord_data)
accord_path = os.path.join(temp_dir, 'accord_cut.csv')
accord_df.to_csv(accord_path, index=False)

# Patch os.path and pd.read_csv to use our temp directory
original_read_csv = pd.read_csv

def patched_read_csv(filepath, *args, **kwargs):
    if 'sprint_cut.csv' in filepath:
        filepath = sprint_path
    elif 'accord_cut.csv' in filepath:
        filepath = accord_path
    return original_read_csv(filepath, *args, **kwargs)

pd.read_csv = patched_read_csv

ARGS = {
    'dataset': 'sprint'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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
run_for_ascvd Ran
ran on a synthesized input
tonyduan/hte-prediction-rcts/src/baselines.py
code served (permissive licence) · get_code("b5e9d85bbda9441b")
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 (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 numpy as np

# Create a small dataset with the required structure
# The function expects dataset['X'] and dataset['y']
# Based on the code, X rows need: [age, female, black, ..., chol, hdl, ..., sbp, ..., smk, ..., dia]
# Let's construct X with proper dimensions

num_samples = 2

# Create X array with 8 features (indices 0-7 used in function)
# Index 0: age, Index 1: female (0/1), Index 2: black (0/1), Index 5: sbp, 
# Index 7: smk, Index -5: chol, Index -4: hdl, Index -1: dia
X = np.array([
    [50.0, 0, 0, 200.0, 150.0, 120.0, 0.0, 0, 0.0],  # male, white
    [55.0, 1, 1, 210.0, 160.0, 130.0, 1.0, 1, 1.0],  # female, black
], dtype=float)

# Create y array (target values, shape must match X rows)
y = np.array([0, 1], dtype=float)

# Construct the dataset dict
dataset = {
    'X': X,
    'y': y
}

ARGS = {
    'dataset': dataset
}
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 (2,) — shape (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
wald_test Ran
ran on a synthesized input
tonyduan/hte-prediction-rcts/src/evaluate.py
code served (permissive licence) · get_code("ff7043251da03ae4")
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
import scipy as sp

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

# Create small valid arguments for the wald_test function
# pred_rr: array of predicted relative risks (continuous values)
# y: binary outcome array (0 or 1, representing survival or event)
# w: treatment assignment array (0 = control, 1 = treatment)

# Generate sample data with enough variation to avoid all-zero contingency tables
pred_rr = np.array([0.5, -0.3, 0.8, -0.2])  # Mix of positive and negative values
y = np.array([1, 0, 1, 1])  # Binary outcomes
w = np.array([0, 1, 0, 1])  # Treatment assignment

ARGS = {
    "pred_rr": pred_rr,
    "y": y,
    "w": w
}
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

Also present in other papers' code

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

Practitioners in medicine, business, political science, and other fields are increasingly aware that decisions should be personalized to each patient, customer, or voter. A given treatment (e.g. a drug or advertisement) should be administered only to those who will respond most positively, and certainly not to those who will be harmed by it. Individual-level treatment effects can be estimated with tools adapted from machine learning, but different models can yield contradictory estimates. Unlike risk prediction models, however, treatment effect models cannot be easily evaluated against each other using a held-out test set because the true treatment effect itself is never directly observed. Besides outcome prediction accuracy, several metrics that can leverage held-out data to evaluate treatment effects models have been proposed, but they are not widely used. We provide a didactic framework that elucidates the relationships between the different approaches and compare them all using a variety of simulations of both randomized and observational data. Our results show that researchers estimating heterogenous treatment effects need not limit themselves to a single model-fitting algorithm. Instead of relying on a single method, multiple models fit by a diverse set of algorithms should be evaluated against each other using an objective function learned from the validation set. The model minimizing that objective should be used for estimating the individual treatment effect for future individuals.

For agents

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

get_harvested_code_for_paper("1804.05146")
get_code_for_paper("1804.05146")
have("1804.05146")

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

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

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

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

Connect an agent — have() is free.