SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2207.04771 · 2022

Functional Generalized Empirical Likelihood Estimation for Conditional Moment Restrictions

arXiv · PDF · Open in the Atlas

Code that ran

2 of 4 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 2 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/2207.04771.json · badge: /api/ran/2207.04771.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
heinerkremer/functional-gel canonical (classifier label)
classifier basis not recorded on the link
2 ran · 2 no recorded run
FunctionStatusWhere it lives
eval_model Ran
ran on a synthesized input
heinerkremer/functional-gel/experiments/exp_heteroskedastic.py
code served (permissive licence) · get_code("f20aede6409c0bb5")
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 (2, 1) 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)

# Create small tensors with distinct dimensions
# t should be a 2D tensor (batch_size, feature_dim)
t_torch = torch.randn(2, 4)  # batch=2, features=4
t_numpy = np.random.randn(2, 4)

# theta should be 1D tensor/array that broadcasts with t
theta_torch = torch.randn(4)  # 4 features
theta_numpy = np.random.randn(4)

# Define arguments for both numpy=False and numpy=True cases
ARGS = {
    't': t_torch,
    'theta': theta_torch,
    'numpy': False
}
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 (2, 1) — shape (2, 1) 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
run_parallel Ran
ran on a synthesized input
heinerkremer/functional-gel/run_experiment.py
code served (permissive licence) · get_code("99dde4791f5fb33a")
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 generator. 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
import numpy as np

torch.manual_seed(0)
np.random.seed(0)

# Define minimal experiment class
class SimpleExperiment:
    def __init__(self, dim_input=4, dim_output=1):
        self.dim_input = dim_input
        self.dim_output = dim_output
        self.x_train = None
        self.z_train = None
        self.x_val = None
        self.z_val = None
        self.x_test = None
        self.z_test = None
        self.true_params = np.array([0.5, -0.3, 0.2, 0.1])
    
    def setup_data(self, n_train, n_val, n_test):
        self.x_train = torch.randn(n_train, self.dim_input)
        self.z_train = torch.randn(n_train, self.dim_output)
        self.x_val = torch.randn(n_val, self.dim_input)
        self.z_val = torch.randn(n_val, self.dim_output)
        self.x_test = torch.randn(n_test, self.dim_input)
        self.z_test = torch.randn(n_test, self.dim_output)
    
    def init_model(self):
        return SimpleModel(self.dim_input, self.dim_output)
    
    def eval_test_risk(self, model, x):
        output = model(x)
        return torch.mean((output - 0.0) ** 2)
    
    def get_true_parameters(self):
        return self.true_params

# Define minimal model class
class SimpleModel(nn.Module):
    def __init__(self, dim_input=4, dim_output=1):
        super().__init__()
        self.linear = nn.Linear(dim_input, dim_output)
    
    def forward(self, x):
        return self.linear(x)
    
    def get_parameters(self):
        return self.linear.weight.data.clone().detach()

# Define minimal estimator class
class SimpleEstimator:
    def __init__(self, model, learning_rate=0.01):
        self.model = model
        self.learning_rate = learning_rate
        self.optimizer = torch.optim.SGD(self.model.parameters(), lr=learning_rate)
    
    def train(self, x_train, z_train, x_val, z_val):
        for epoch in range(2):
            self.optimizer.zero_grad()
            output = self.model(x_train)
            loss = torch.mean((output - z_train) ** 2)
            loss.backward()
            self.optimizer.step()
    
    def _calc_val_mmr(self, x_val, z_val):
        output = self.model(x_val)
        mmr = torch.mean((output - z_val) ** 2)
        return mmr

# Setup ARGS
ARGS = {
    'experiment': SimpleExperiment,
    'exp_params': {'dim_input': 4, 'dim_output': 1},
    'n_train': 8,
    'estimator_class': SimpleEstimator,
    'estimator_kwargs': {'learning_rate': 0.01},
    'hyperparams': {'learning_rate': [0.001, 0.01]},
    'repititions': 2,
    'seed0': 12345
}
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 generator — a generator output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a generator 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_experiment Not yet run
unverified (harvested, no recorded run)
heinerkremer/functional-gel/run_experiment.py
code served (permissive licence) · get_code("8dfc976d4c69f79b")
How it ran

no invocation recorded.

run_experiment_repeated Not yet run
unverified (harvested, no recorded run)
heinerkremer/functional-gel/run_experiment.py
code served (permissive licence) · get_code("f0395d16d6c7623f")
How it ran

no invocation recorded.

Also present in other papers' code

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

Important problems in causal inference, economics, and, more generally, robust machine learning can be expressed as conditional moment restrictions, but estimation becomes challenging as it requires solving a continuum of unconditional moment restrictions. Previous works addressed this problem by extending the generalized method of moments (GMM) to continuum moment restrictions. In contrast, generalized empirical likelihood (GEL) provides a more general framework and has been shown to enjoy favorable small-sample properties compared to GMM-based estimators. To benefit from recent developments in machine learning, we provide a functional reformulation of GEL in which arbitrary models can be leveraged. Motivated by a dual formulation of the resulting infinite dimensional optimization problem, we devise a practical method and explore its asymptotic properties. Finally, we provide kernel- and neural network-based implementations of the estimator, which achieve state-of-the-art empirical performance on two conditional moment restriction problems.

For agents

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

get_harvested_code_for_paper("2207.04771")
get_code_for_paper("2207.04771")
have("2207.04771")

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

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

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

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

Connect an agent — have() is free.