SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1902.00450 · 2019

Time Series Deconfounder: Estimating Treatment Effects over Time in the Presence of Hidden Confounders

arXiv · PDF · Open in the Atlas

Code that ran

6 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; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 2 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/1902.00450.json · badge: /api/ran/1902.00450.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
ioanabica/Time-Series-Deconfounder canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_predictive_checks_eval_metric Ran
ran on a synthesized input
ioanabica/Time-Series-Deconfounder/utils/predictive_checks_utils.py
code served (permissive licence) · get_code("c17b0ad606536eef")
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. 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 sklearn.metrics import mean_squared_error

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

# Create a sample p_values_over_time array
# This should be a 1D numpy array with some non-zero values followed by zeros
# Let's create an array with meaningful p-values in the first few positions
p_values_over_time = np.array([0.3, 0.4, 0.6, 0.55, 0.0, 0.0, 0.0], dtype=np.float32)

ARGS = {
    "p_values_over_time": p_values_over_time
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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_test_statistic_all_timesteps Ran
ran on a synthesized input
ioanabica/Time-Series-Deconfounder/utils/predictive_checks_utils.py
code served (permissive licence) · get_code("0e7ef3ed19120c98")
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 (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

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

# Define parameters
batch_size = 2
max_sequence_length = 3
num_treatments = 4

# treatment_replica: shape (batch_size, max_sequence_length, num_treatments)
# Contains binary treatment indicators (0 or 1)
treatment_replica = np.random.randint(0, 2, size=(batch_size, max_sequence_length, num_treatments)).astype(np.float32)

# treatment_probability: shape (batch_size, max_sequence_length, num_treatments)
# Contains probabilities for each treatment
treatment_probability = np.random.uniform(0.1, 0.9, size=(batch_size, max_sequence_length, num_treatments)).astype(np.float32)

# max_sequence_length: integer representing the maximum sequence length
max_sequence_length = max_sequence_length

# predicted_mask: shape (batch_size, max_sequence_length)
# Binary mask indicating which timesteps are valid
predicted_mask = np.random.randint(0, 2, size=(batch_size, max_sequence_length)).astype(np.float32)

ARGS = {
    "treatment_replica": treatment_replica,
    "treatment_probability": treatment_probability,
    "max_sequence_length": max_sequence_length,
    "predicted_mask": predicted_mask,
}
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 (3,) — shape (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_dataset_splits Ran
ran on a synthesized input
ioanabica/Time-Series-Deconfounder/time_series_deconfounder.py
code served (permissive licence) · get_code("2a8ccd2bd649a431")
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 torch
import numpy as np

torch.manual_seed(0)

# Create a mock dataset dictionary with the required keys
# The function indexes along the first dimension (batch), so we need:
# - batch_size = 10 (will be split into train/val/test)
# - time steps = 5
# - num_covariates = 4

batch_size = 10
time_steps = 5
num_covariates = 4

dataset = {
    'previous_covariates': torch.randn(batch_size, time_steps, num_covariates),
    'previous_treatments': torch.randn(batch_size, time_steps, 2),
    'covariates': torch.randn(batch_size, time_steps, num_covariates),
    'treatments': torch.randn(batch_size, time_steps, 2),
    'predicted_confounders': torch.randn(batch_size, time_steps, 3),
    'outcomes': torch.randn(batch_size, time_steps, 1),
    'sequence_length': torch.randint(1, time_steps + 1, (batch_size,)),
}

# Create train/val/test indices
train_index = np.array([0, 1, 2, 3, 4])
val_index = np.array([5, 6, 7])
test_index = np.array([8, 9])

use_predicted_confounders = True

ARGS = {
    'dataset': dataset,
    'train_index': train_index,
    'val_index': val_index,
    'test_index': test_index,
    'use_predicted_confounders': use_predicted_confounders,
}
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 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
get_parameters_from_string Ran
ran on a synthesized input
ioanabica/Time-Series-Deconfounder/rmsn/configs.py
code served (permissive licence) · get_code("93dde245ceafbc0c")
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 torch
import numpy as np

torch.manual_seed(0)

serialisation_string = "0.5_128_10_32_0.001_1.0"

ARGS = {
    "serialisation_string": serialisation_string
}
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 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
randomise_minibatch_index Ran
ran on a synthesized input
ioanabica/Time-Series-Deconfounder/rmsn/libs/net_helpers.py
code served (permissive licence) · get_code("d78cd8d573b89986")
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 list, ndim 2, dtype family int; 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

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

# Create a small sample Y array with shape (batch_num, target_num)
# Using distinct dimensions: 6 samples, 3 targets
Y = np.random.randn(6, 3)

minibatch_size = 2

ARGS = {
    "Y": Y,
    "minibatch_size": minibatch_size
}
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 list, ndim 2, dtype family int — a list 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
reshape_for_sklearn Ran
ran on a synthesized input
ioanabica/Time-Series-Deconfounder/rmsn/libs/net_helpers.py
code served (permissive licence) · get_code("5bd3abf588391af9")
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 (6, 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
import numpy as np

torch.manual_seed(0)

# The function reshape_for_sklearn takes an input tensor/array
# and reshapes it to [-1, ip.shape[-1]]
# This flattens all dimensions except the last one

# Create a small tensor with shape (2, 3, 4)
# where -1 will reshape to (6, 4)
ip = torch.randn(2, 3, 4)

ARGS = {
    "ip": ip
}
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 (6, 4) — shape (6, 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
convert_to_tf_dataset Not yet run
unverified (harvested, no recorded run)
ioanabica/Time-Series-Deconfounder/rmsn/core_routines.py
code served (permissive licence) · get_code("8d4ca4c79c1e789b")
How it ran

no invocation recorded.

linear Not yet run
unverified (harvested, no recorded run)
ioanabica/Time-Series-Deconfounder/rmsn/libs/net_helpers.py
code served (permissive licence) · get_code("e44ac986e2579df6")
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-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

The estimation of treatment effects is a pervasive problem in medicine. Existing methods for estimating treatment effects from longitudinal observational data assume that there are no hidden confounders, an assumption that is not testable in practice and, if it does not hold, leads to biased estimates. In this paper, we develop the Time Series Deconfounder, a method that leverages the assignment of multiple treatments over time to enable the estimation of treatment effects in the presence of multi-cause hidden confounders. The Time Series Deconfounder uses a novel recurrent neural network architecture with multitask output to build a factor model over time and infer latent variables that render the assigned treatments conditionally independent; then, it performs causal inference using these latent variables that act as substitutes for the multi-cause unobserved confounders. We provide a theoretical analysis for obtaining unbiased causal effects of time-varying exposures using the Time Series Deconfounder. Using both simulated and real data we show the effectiveness of our method in deconfounding the estimation of treatment responses over time.

For agents

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

get_harvested_code_for_paper("1902.00450")
get_code_for_paper("1902.00450")
have("1902.00450")

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

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

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

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

Connect an agent — have() is free.