SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.13373 · 2022

Local Metric Learning for Off-Policy Evaluation in Contextual Bandits with Continuous Actions

arXiv · PDF · Open in the Atlas

Code that ran

6 of 11 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 5 have no contract verdict; 1 failure 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/2210.13373.json · badge: /api/ran/2210.13373.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
haanvid/kmis canonical (classifier label)
classifier basis not recorded on the link
6 ran · 5 no recorded run
FunctionStatusWhere it lives
batch_hessian Ran
ran on a synthesized input
haanvid/kmis/util.py
code served (permissive licence) · get_code("2a6dd5d2668b3f32")
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 3, dtype family float; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T23:14:07Z. 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 autograd
import autograd.numpy as np

# Define a simple function f that takes (N x D) and returns (D)
def f(x):
    # x shape: (N x D)
    # returns shape: (D,)
    # Simple function: sum along batch dimension, then apply some nonlinearity
    return np.sum(x ** 2, axis=0) + np.sum(np.sin(x), axis=0)

# Create input x with shape (N x D) = (2 x 4)
N = 2
D = 4
x = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [0.5, 1.5, 2.5, 3.5]
], dtype=np.float64)

ARGS = {
    "f": f,
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
autograd — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
gaussian_kernel Ran
ran on a synthesized input
haanvid/kmis/off_pol_eval_functs.py
code served (permissive licence) · get_code("0f48c368746fcb00")
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 float64, ndim 0, 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 autograd.numpy as np

# The function gaussian_kernel takes a single parameter 'u'
# which is used with np.inner (dot product) and len()
# This indicates u should be a 1D array-like object

# Create a small 1D numpy array
u = np.array([1.0, 2.0, 3.0, 0.5])

ARGS = {
    "u": u
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
autograd — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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_dict Ran
ran; our contract draft was wrong, not the code
haanvid/kmis/main_dummy.py
code served (permissive licence) · get_code("ac63e9a19256d49f")
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 pickle
import tempfile
import os

# Create a temporary file with pickled data
test_dict = {
    'key1': 'value1',
    'key2': [1, 2, 3],
    'key3': {'nested': 'dict'}
}

# Create a temporary pickle file
temp_dir = tempfile.gettempdir()
temp_filename = os.path.join(temp_dir, 'test_pickle_load.pkl')

with open(temp_filename, 'wb') as f:
    pickle.dump(test_dict, f)

ARGS = {
    'filename_': temp_filename
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
metric_evaluation Ran
ran on a synthesized input
haanvid/kmis/off_pol_eval_functs.py
code served (permissive licence) · get_code("a1a22f2643fd92e3")
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 float64, ndim 0, 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 autograd.numpy as np

# Define a simple kernel function that takes a scalar and returns a scalar
def simple_kernel(x):
    """A simple kernel function - Gaussian-like"""
    return np.exp(-0.5 * np.sum(x**2))

# Set up the arguments
n_samples = 2
state_dim = 4
action_dim = 3
L_dim = 3

# h_samp: bandwidth parameter (scalar)
h_samp = 1.0

# L_samp: transformation matrices, shape (n_samples, action_dim, action_dim)
L_samp = np.array([
    np.eye(action_dim),
    np.eye(action_dim) * 0.5
])

# kernel: callable that takes an array and returns a scalar
kernel = simple_kernel

# behav_pol_val_samp: behavior policy density values, shape (n_samples,)
behav_pol_val_samp = np.array([0.5, 0.6])

# states_samp: state samples, shape (n_samples, state_dim)
states_samp = np.random.randn(n_samples, state_dim)

# behav_acts_samp: behavior actions, shape (n_samples, action_dim)
behav_acts_samp = np.random.randn(n_samples, action_dim)

# behav_risks_samp: behavior risks, shape (n_samples, 1) - 2D array with single column
behav_risks_samp = np.array([[0.1], [0.2]])

# targ_acts_samp: target actions, shape (n_samples, action_dim)
targ_acts_samp = np.random.randn(n_samples, action_dim)

# clip_ratio: clipping ratio (scalar)
clip_ratio = 0.01

ARGS = {
    "h_samp": h_samp,
    "L_samp": L_samp,
    "kernel": kernel,
    "behav_pol_val_samp": behav_pol_val_samp,
    "states_samp": states_samp,
    "behav_acts_samp": behav_acts_samp,
    "behav_risks_samp": behav_risks_samp,
    "targ_acts_samp": targ_acts_samp,
    "clip_ratio": clip_ratio,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
autograd — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
off_policy_evaluation Ran
ran on a synthesized input
haanvid/kmis/off_pol_eval_functs.py
code served (permissive licence) · get_code("b562006a4fd9cd97")
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 float64, ndim 0, 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 autograd.numpy as np
import numpy as onp

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

# Number of samples
n_samp = 2

# h_samp: bandwidth parameter (scalar)
h_samp = 0.5

# kernel: function that takes a value and returns a density
def kernel(x):
    # Simple Gaussian kernel
    return np.exp(-0.5 * x**2) / np.sqrt(2 * np.pi)

# behav_pol_val_samp: behavioral policy density values (n_samp,)
behav_pol_val_samp = np.array([0.3, 0.4])

# states_samp: states (n_samp, state_dim)
states_samp = np.random.randn(n_samp, 4)

# behav_acts_samp: behavioral actions (n_samp,)
behav_acts_samp = np.array([0.1, 0.2])

# behav_risks_samp: behavioral risks/rewards (n_samp, 1)
behav_risks_samp = np.array([[1.5], [2.0]])

# targ_acts_samp: target actions (n_samp,)
targ_acts_samp = np.array([0.15, 0.25])

# clip_ratio: clipping threshold (scalar)
clip_ratio = 0.01

ARGS = {
    "h_samp": h_samp,
    "kernel": kernel,
    "behav_pol_val_samp": behav_pol_val_samp,
    "states_samp": states_samp,
    "behav_acts_samp": behav_acts_samp,
    "behav_risks_samp": behav_risks_samp,
    "targ_acts_samp": targ_acts_samp,
    "clip_ratio": clip_ratio,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
autograd, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
shuffle_data Ran
ran on a synthesized input
haanvid/kmis/util.py
code served (permissive licence) · get_code("a66e33d74b337fed")
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 autograd.numpy as np

np.random.seed(0)

# Create small sample data
states = np.random.randn(5, 4)  # 5 samples, 4 state dimensions
behav_acts = np.random.randn(5, 3)  # 5 samples, 3 action dimensions
behav_risks = np.random.randn(5, 2)  # 5 samples, 2 risk dimensions
sample_size = 3

ARGS = {
    "states": states,
    "behav_acts": behav_acts,
    "behav_risks": behav_risks,
    "sample_size": sample_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
autograd — 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
batch_hessian_tf Not yet run
unverified (harvested, no recorded run)
haanvid/kmis/util.py
code served (permissive licence) · get_code("292ed60be86050df")
How it ran

no invocation recorded.

disc_evaluation Not yet run
unverified (harvested, no recorded run)
haanvid/kmis/disc_ope.py
code served (permissive licence) · get_code("57d7d9dc4dc72fd3")
How it ran

no invocation recorded.

gen_unif_state Not yet run
unverified (harvested, no recorded run)
haanvid/kmis/main_dummy.py
code served (permissive licence) · get_code("7f0b9fa3eb72a958")
How it ran

no invocation recorded.

get_behavior_policy_prob Not yet run
unverified (harvested, no recorded run)
haanvid/kmis/disc_ope.py
code served (permissive licence) · get_code("db802997214da3fe")
How it ran

no invocation recorded.

histogram Not yet run
unverified (harvested, no recorded run)
haanvid/kmis/disc_ope.py
code served (permissive licence) · get_code("919e956d58f0bc54")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
load_dict 2 other papers
2 later
2312.05063 (2023-12)
Individualizing Glioma Radiotherapy Planning by Optimization of Data and Physics-Informed Discrete Loss
2408.03675 (2024-08)
NACL: A General and Effective KV Cache Eviction Framework for LLMs at Inference Time

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 consider local kernel metric learning for off-policy evaluation (OPE) of deterministic policies in contextual bandits with continuous action spaces. Our work is motivated by practical scenarios where the target policy needs to be deterministic due to domain requirements, such as prescription of treatment dosage and duration in medicine. Although importance sampling (IS) provides a basic principle for OPE, it is ill-posed for the deterministic target policy with continuous actions. Our main idea is to relax the target policy and pose the problem as kernel-based estimation, where we learn the kernel metric in order to minimize the overall mean squared error (MSE). We present an analytic solution for the optimal metric, based on the analysis of bias and variance. Whereas prior work has been limited to scalar action spaces or kernel bandwidth selection, our work takes a step further being capable of vector action spaces and metric optimization. We show that our estimator is consistent, and significantly reduces the MSE compared to baseline OPE methods through experiments on various domains.

For agents

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

get_harvested_code_for_paper("2210.13373")
get_code_for_paper("2210.13373")
have("2210.13373")

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

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

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

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

Connect an agent — have() is free.