SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2002.10271 · 2020

Testing Goodness of Fit of Conditional Density Models with Kernels

arXiv · PDF · Open in the Atlas

Code that ran

4 of 9 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 4 have no contract verdict; 0 failures of our instrument; 5 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/2002.10271.json · badge: /api/ran/2002.10271.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
wittawatj/kernel-cgof canonical (classifier label)
classifier basis: census
4 ran · 5 no recorded run
FunctionStatusWhere it lives
plot_2d_cond_model Ran
ran on a synthesized input
wittawatj/kernel-cgof/kcgof/plot.py
code served (permissive licence) · get_code("42f3e1bd0393faba")
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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Create a mock UnnormalizedCondDensity class
class MockCondDensity(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(2, 1)
    
    def log_normalized_den(self, x, y):
        """Takes x (n x 1) and y (n x 1), returns log density (n,)"""
        # Simple mock: combine x and y, pass through linear layer
        combined = torch.cat([x, y], dim=1)
        logden = self.linear(combined).squeeze(-1)
        return logden

# Create mock px callable
def mock_px(x):
    """Takes x (n x 1), returns density values (n,)"""
    # Simple mock: exponential-like density
    return torch.exp(-0.5 * x**2).squeeze(-1)

# Create data
X = torch.randn(2, 1)  # 2 samples, 1D
Y = torch.randn(2, 1)  # 2 samples, 1D

# Create domain grids
domX = torch.linspace(-3, 3, 5)  # 5 points in x domain
domY = torch.linspace(-3, 3, 4)  # 4 points in y domain (distinct from domX size)

# Build ARGS dictionary
ARGS = {
    'p': MockCondDensity(),
    'px': mock_px,
    'X': X,
    'Y': Y,
    'domX': domX,
    'domY': domY,
    'figsize': (10, 6),
    'height_ratios': [3, 1],
    'levels': 20,
    'cmap': 'pink_r'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, 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
pt_dist2_matrix Ran
ran on a synthesized input
wittawatj/kernel-cgof/kcgof/util.py
code served (permissive licence) · get_code("17e3173af38355ac")
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, 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 torch

torch.manual_seed(0)

# Create small tensors for X and Y
# X is Nxd matrix (N=2 samples, d=4 dimensions)
X = torch.randn(2, 4)

# Y is Mxd matrix (M=3 samples, d=4 dimensions) - distinct size from N
Y = torch.randn(3, 4)

ARGS = {
    "X": X,
    "Y": Y
}
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 Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 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
pt_meddistance Ran
ran on a synthesized input
wittawatj/kernel-cgof/kcgof/util.py
code served (permissive licence) · get_code("fddcb0eecffc943b")
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 float, 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 torch
import numpy as np

class NumpySeedContext:
    """Context manager for numpy random seed"""
    def __init__(self, seed):
        self.seed = seed
        self.state = None
    
    def __enter__(self):
        self.state = np.random.get_state()
        np.random.seed(self.seed)
        return self
    
    def __exit__(self, *args):
        np.random.set_state(self.state)

torch.manual_seed(0)

# Create a small test tensor: 4 points in 3-dimensional space
X = torch.randn(4, 3, dtype=torch.float32)

ARGS = {
    'X': X,
    'subsample': None,
    'seed': 283
}
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 float, 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
pt_sample_standard_normal Ran
ran on a synthesized input
wittawatj/kernel-cgof/kcgof/util.py
code served (permissive licence) · get_code("5495b4cc34218d4c")
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

torch.manual_seed(0)

# pt_sample_standard_normal takes two parameters:
# - n: number of samples (int)
# - d: number of dimensions (int)
# The function simply calls torch.randn(n, d) and returns it

ARGS = {
    "n": 2,
    "d": 4,
}
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 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
ex_load_result Not yet run
unverified (harvested, no recorded run)
wittawatj/kernel-cgof/kcgof/glo.py
code served (permissive licence) · get_code("570643b58b4fab89")
How it ran

no invocation recorded.

ex_result_file Not yet run
unverified (harvested, no recorded run)
wittawatj/kernel-cgof/kcgof/glo.py
code served (permissive licence) · get_code("9cafac0a5f0d06cb")
How it ran

no invocation recorded.

ex_result_folder Not yet run
unverified (harvested, no recorded run)
wittawatj/kernel-cgof/kcgof/glo.py
code served (permissive licence) · get_code("6d5c30d0b91073b7")
How it ran

no invocation recorded.

from_grad_log Not yet run
unverified (harvested, no recorded run)
wittawatj/kernel-cgof/kcgof/cdensity.py
code served (permissive licence) · get_code("0476f410fdacb77b")
How it ran

no invocation recorded.

from_log_den Not yet run
unverified (harvested, no recorded run)
wittawatj/kernel-cgof/kcgof/cdensity.py
code served (permissive licence) · get_code("bd1df801cc04a09e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 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.

FunctionAlso present inEarliest-datedOthers named
ex_load_result 2 other papers
2 dated earlier
1705.07673 (2017-05)
A Linear-Time Kernel Goodness-of-Fit Test
1907.00586 (2019-07)
A Kernel Stein Test for Comparing Latent Variable Models
ex_result_file 2 other papers
2 dated earlier
1705.07673 (2017-05)
A Linear-Time Kernel Goodness-of-Fit Test
1907.00586 (2019-07)
A Kernel Stein Test for Comparing Latent Variable Models
ex_result_folder 2 other papers
2 dated earlier
1705.07673 (2017-05)
A Linear-Time Kernel Goodness-of-Fit Test
1907.00586 (2019-07)
A Kernel Stein Test for Comparing Latent Variable Models

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 propose two nonparametric statistical tests of goodness of fit for conditional distributions: given a conditional probability density function $p(y|x)$ and a joint sample, decide whether the sample is drawn from $p(y|x)r_x(x)$ for some density $r_x$. Our tests, formulated with a Stein operator, can be applied to any differentiable conditional density model, and require no knowledge of the normalizing constant. We show that 1) our tests are consistent against any fixed alternative conditional model; 2) the statistics can be estimated easily, requiring no density estimation as an intermediate step; and 3) our second test offers an interpretable test result providing insight on where the conditional model does not fit well in the domain of the covariate. We demonstrate the interpretability of our test on a task of modeling the distribution of New York City's taxi drop-off location given a pick-up point. To our knowledge, our work is the first to propose such conditional goodness-of-fit tests that simultaneously have all these desirable properties.

For agents

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

get_harvested_code_for_paper("2002.10271")
get_code_for_paper("2002.10271")
have("2002.10271")

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

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

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

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

Connect an agent — have() is free.