SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.13079 · 2022

Learning Optimal Test Statistics in the Presence of Nuisance Parameters

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 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 9 have no contract verdict; 0 failures of our instrument; 1 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/2203.13079.json · badge: /api/ran/2203.13079.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
lukasheinrich/learning_best_average_power canonical (classifier label)
classifier basis not recorded on the link
9 ran · 1 no recorded run
FunctionStatusWhere it lives
generate_data Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_train.py
code served (permissive licence) · get_code("381e82d3eb0c4a3b")
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
import torch

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

class MockProbModel:
    """Mock probabilistic model matching the interface used in generate_data"""
    
    def prob_model_nuis_range(self, mode):
        """Return a range for nuisance parameter sampling"""
        return (0.1, 0.9)
    
    def sample_prob_model(self, params, N):
        """
        Sample from the probabilistic model.
        params: array of [poi, nuis] parameters
        N: number of samples
        Returns: (N, 4) array of samples
        """
        # Simple mock: generate N samples of dimension 4
        return np.random.randn(N, 4).astype(np.float32)

xmpl = MockProbModel()

ARGS = {
    'xmpl': xmpl,
    'N': 100,
    'scale': 1,
    'poi': 0.0,
    'mode': 'eval'
}
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 — 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
generate_data_one_alt Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_train.py
code served (permissive licence) · get_code("5efc29a73ce68cb8")
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
import torch

torch.manual_seed(0)

class StandInExample:
    """Minimal stand-in for xmpl parameter"""
    
    def sample_prob_model(self, params, N):
        """Sample from a probability model given parameters"""
        # params is a list like [poi, nuis]
        # Return N samples of dimension 4
        np.random.seed(42)
        return np.random.randn(N, 4).astype(np.float32)
    
    def prob_model_nuis_range(self, mode):
        """Return range for nuisance parameter"""
        return (0.5, 2.0)

ARGS = {
    'xmpl': StandInExample(),
    'N': 2,
    'scale': 1,
    'poi': 0.0,
    'nuis_null': 1.0,
    'mode': 'eval'
}
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 — 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
generate_fixed_ref Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_train.py
code served (permissive licence) · get_code("029024c21cf5f692")
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
import torch

torch.manual_seed(0)

class MockProbModel:
    """Stand-in class that implements sample_prob_model method."""
    
    def sample_prob_model(self, params, N):
        """
        Sample from a probability model.
        params: array of parameters
        N: number of samples to generate
        Returns: array of shape (N, feature_dim)
        """
        # Generate random samples with shape (N, 4) for feature dimension
        np.random.seed(0)
        return np.random.randn(N, 4).astype(np.float32)

# Create the example object
xmpl = MockProbModel()

# Define parameters
N = 2  # small number of samples
null = np.array([0.1, 0.2, 0.3])  # null hypothesis parameters
alt = np.array([0.4, 0.5, 0.6])   # alternative hypothesis parameters

ARGS = {
    "xmpl": xmpl,
    "N": N,
    "null": null,
    "alt": alt,
}
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 — 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
get_errs Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_plots.py
code served (permissive licence) · get_code("c158699397f4fe10")
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)

# The function get_errs takes two array-like objects (a, b) and a cut threshold.
# It filters elements > cut, computes the ratio of filtered size to total size for each.
# We need to provide numpy arrays or torch tensors that support boolean indexing.

a = torch.tensor([0.1, 0.5, 1.5, 2.0, 0.3], dtype=torch.float32)
b = torch.tensor([0.2, 0.8, 1.2, 2.5, 0.4], dtype=torch.float32)
cut = 0.7

ARGS = {
    "a": a,
    "b": b,
    "cut": cut
}
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
get_roc Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_plots.py
code served (permissive licence) · get_code("7141067cdd9524c9")
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 2, 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

# Analyze the function:
# get_roc(a, b, range=(0, 1))
# - a: numpy array, used with a > cut (comparison)
# - b: numpy array, used with b > cut (comparison)
# - range: tuple with 2 elements, default (0, 1)

# Create numpy arrays with distinct sizes for testing
np.random.seed(0)
a = np.random.rand(100)  # 100 elements
b = np.random.rand(50)   # 50 elements (distinct size)

ARGS = {
    "a": a,
    "b": b,
    "range": (0, 1)
}
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 2, 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
lrt_test_stat Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_groundtruth.py
code served (permissive licence) · get_code("ae6ff4496fbb723d")
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

class ProbabilityModel:
    """Stand-in probability model with required methods."""
    
    def prob_model_mhat(self, data):
        """Return MLE estimate of m parameter for each data point."""
        # Returns shape (len(data), 2) - two parameters
        return np.random.randn(len(data), 2)
    
    def prob_model_nuhat(self, data):
        """Return MLE estimate of nu parameter for each data point."""
        # Returns shape (len(data),) - one parameter
        return np.random.randn(len(data))
    
    def getnuhathat(self, at, data):
        """Return constrained estimate of nu when m is fixed at 'at'."""
        # Returns shape (len(data),) - one parameter per data point
        return np.random.randn(len(data))
    
    def logpdf_prob_model(self, params, datum):
        """Compute log probability density.
        
        Args:
            params: array of shape (2,) with [m_value, nu_value]
            datum: single data point
        
        Returns:
            float - log probability density
        """
        # Simple stand-in: sum of params as a scalar log probability
        return float(np.sum(params))


# Create mock data - list of 2 data points
data = [np.array([1.0, 2.0]), np.array([3.0, 4.0])]

# Create model instance
xmpl = ProbabilityModel()

# Fixed m value to test under null hypothesis
at = np.array([0.5, 0.5])

ARGS = {
    'xmpl': xmpl,
    'at': at,
    'data': data,
}
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
preprocess Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_gaussian.py
code served (permissive licence) · get_code("b48dfd57609beaa2")
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, 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 preprocess(X) simply returns X unchanged
# X should be a tensor or array-like object
X = torch.randn(2, 4)

ARGS = {
    "X": X
}
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, 4) — shape (2, 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
prob_model_nuis_range Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_gaussian.py
code served (permissive licence) · get_code("e372ea4ae8a4ada8")
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 1, 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 torch
import numpy as np

torch.manual_seed(0)

ARGS = {
    'mode': 'eval'
}
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 list, ndim 1, 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
prob_model_poi_range Ran
ran on a synthesized input
lukasheinrich/learning_best_average_power/wald_gaussian.py
code served (permissive licence) · get_code("70864c3bec89a93f")
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 1, 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 torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'mode': 'eval'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, 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
auto_rescale_func Not yet run
unverified (harvested, no recorded run)
lukasheinrich/learning_best_average_power/wald_plots.py
code served (permissive licence) · get_code("76b4b3f7991e1c81")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 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 10 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 design of optimal test statistics is a key task in frequentist statistics and for a number of scenarios optimal test statistics such as the profile-likelihood ratio are known. By turning this argument around we can find the profile likelihood ratio even in likelihood-free cases, where only samples from a simulator are available, by optimizing a test statistic within those scenarios. We propose a likelihood-free training algorithm that produces test statistics that are equivalent to the profile likelihood ratios in cases where the latter is known to be optimal.

For agents

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

get_harvested_code_for_paper("2203.13079")
get_code_for_paper("2203.13079")
have("2203.13079")

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

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

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

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

Connect an agent — have() is free.