SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1806.01347 · 2018

Importance Sampling Policy Evaluation with an Estimated Behavior Policy

arXiv · PDF · Open in the Atlas

Code that ran

10 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 10 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/1806.01347.json · badge: /api/ran/1806.01347.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
LARG/regression-importance-sampling canonical (classifier label)
classifier basis: census
10 ran · 1 no recorded run
FunctionStatusWhere it lives
discount_cumsum Ran
ran on a synthesized input
LARG/regression-importance-sampling/roboschool-experiments/common.py
code served (permissive licence) · get_code("128b553ce11b9774")
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 (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 numpy as np
import scipy.signal

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

# Create sample rewards array
rewards = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float32)

# Create gamma discount factor
gamma = 0.99

ARGS = {
    "rewards": rewards,
    "gamma": gamma
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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 (4,) — shape (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
elongate_space Ran
ran on a synthesized input
LARG/regression-importance-sampling/roboschool-experiments/common.py
code served (permissive licence) · get_code("53774c6ad4124c7d")
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 Box. 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 gym import spaces

# Create observation space: Box space with shape (4,)
obs_space = spaces.Box(
    low=np.array([-1.0, -1.0, -1.0, -1.0]),
    high=np.array([1.0, 1.0, 1.0, 1.0]),
    dtype=np.float32
)

# Create action space: Box space with shape (3,)
act_space = spaces.Box(
    low=np.array([-0.5, -0.5, -0.5]),
    high=np.array([0.5, 0.5, 0.5]),
    dtype=np.float32
)

# Number of repetitions
n = 3

ARGS = {
    "obs_space": obs_space,
    "act_space": act_space,
    "n": n
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
gym, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Box — a Box output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Box 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
eval_target_policy Ran
ran on a synthesized input
LARG/regression-importance-sampling/roboschool-experiments/fit_dist_mse.py
code served (permissive licence) · get_code("fa95abc511ad0f4c")
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 numpy as np

# Construct valid paths for eval_target_policy
# Each path should have 'rewards' (list) and 'cumIWs' (array with final element)

paths = [
    {
        'rewards': [1.0, 2.0, 3.0],
        'cumIWs': np.array([0.5, 0.75, 0.9])
    },
    {
        'rewards': [0.5, 1.5],
        'cumIWs': np.array([0.6, 0.85])
    },
    {
        'rewards': [2.0, 1.0, 0.5, 1.5],
        'cumIWs': np.array([0.4, 0.7, 0.8, 0.95])
    }
]

ARGS = {
    'paths': paths
}
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 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
fit_policy Ran
ran on a synthesized input
LARG/regression-importance-sampling/roboschool-experiments/common.py
code served (permissive licence) · get_code("105bf6358c926751")
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 numpy as np
import torch
import torch.nn as nn

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

# Define a minimal policy class that implements the required methods
class DummyPolicy(nn.Module):
    def __init__(self, obs_dim, act_dim):
        super().__init__()
        self.linear = nn.Linear(obs_dim, act_dim)
        self.obs_dim = obs_dim
        self.act_dim = act_dim
    
    def initialize(self):
        """Reset the policy"""
        nn.init.xavier_uniform_(self.linear.weight)
        nn.init.zeros_(self.linear.bias)
    
    def supervised_update(self, obs_batch, acts_batch):
        """Train on a batch and return loss"""
        obs_tensor = torch.FloatTensor(obs_batch)
        acts_tensor = torch.FloatTensor(acts_batch)
        
        pred = self.linear(obs_tensor)
        loss = nn.MSELoss()(pred, acts_tensor)
        
        # Simulate optimization
        loss.backward()
        with torch.no_grad():
            for param in self.parameters():
                param.grad.zero_()
        
        return float(loss.item())
    
    def eval_loss(self, obs, acts):
        """Compute loss on evaluation data"""
        obs_tensor = torch.FloatTensor(obs)
        acts_tensor = torch.FloatTensor(acts)
        
        with torch.no_grad():
            pred = self.linear(obs_tensor)
            loss = nn.MSELoss()(pred, acts_tensor)
        
        return float(loss.item())

# Create minimal training data
# obs_dim = 4, act_dim = 3
obs_dim = 4
act_dim = 3

# Create small training paths
paths = [
    {
        'observations': np.random.randn(5, obs_dim).astype(np.float32),
        'actions': np.random.randn(5, act_dim).astype(np.float32)
    },
    {
        'observations': np.random.randn(5, obs_dim).astype(np.float32),
        'actions': np.random.randn(5, act_dim).astype(np.float32)
    }
]

policy = DummyPolicy(obs_dim, act_dim)

ARGS = {
    'policy': policy,
    'paths': paths,
    'n_steps': 100,
    'batch_size': 2,
    'eval_freq': 10,
    'stop_criterion': 'holdout',
    'run_twice': False,
    'obs_len': 1,
    'cv_folds': None
}
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
getLineStyle Ran
ran on a synthesized input
LARG/regression-importance-sampling/lds/plot_lds_experiment.py
code served (permissive licence) · get_code("77249e396e51c244")
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 LineStyle. 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

class LineStyle(object):
    def __init__(self, style, color, width, marker=None, markersize=None, dashes=None, alpha=0.5):
        self.color = color
        self.style = style
        self.width = width
        self.marker = marker
        self.markersize = markersize
        self.dashes = dashes
        self.alpha = alpha

plottype = 'gw-baselines'

def getLineStyle(label):
    lower = label.lower()
    if plottype in ['gw-baselines', 'gw-all-baselines']:
        if 'dr' in lower and 'wdr' not in lower:
            style = LineStyle('-', 'c', 2, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '--'
            return style
        if 'wdr' in lower:
            style = LineStyle(':', 'g', 3, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '-.'
            return style
        if lower == 'ois' or lower == 'ris':
            style = LineStyle('--', 'b', 3, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '-'
            return style
        if 'wis' in lower:
            style = LineStyle('-.', 'r', 3, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '--'
            return style
        if 'pdis' in lower:
            style = LineStyle('--', 'k', 2, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '-'
            return style
    elif 'independent' in lower:
        return LineStyle('-.', 'c', 3, alpha=0.25)
    elif 'extra' in lower:
        return LineStyle(':', 'k', 4, alpha=0.25)
    elif lower.startswith('ris'):
        return LineStyle('-', 'b', 3, alpha=0.25)
    elif lower == 'ois':
        return LineStyle('--', 'r', 3, alpha=0.25)
    else:
        return LineStyle('--', 'k', 2, alpha=0.25)

ARGS = {
    'label': 'DR'
}
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 LineStyle — a LineStyle output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LineStyle 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_label Ran
ran on a synthesized input
LARG/regression-importance-sampling/gridworld/plot_gridworld.py
code served (permissive licence) · get_code("29e46de045b54a2b")
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 str. 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

torch.manual_seed(0)

ARGS = {
    "name": "ris_w_pd_dr"
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_label Ran
ran on a synthesized input
LARG/regression-importance-sampling/lds/plot_lds_experiment.py
code served (permissive licence) · get_code("3bc27857c4873591")
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 str. 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

ARGS = {
    'name': 'ris_w_pd_dr'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_label Ran
ran on a synthesized input
LARG/regression-importance-sampling/roboschool-experiments/plot_bar_graph.py
code served (permissive licence) · get_code("963c4ef5fd74f79f")
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 str. 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

torch.manual_seed(0)

ARGS = {
    'name': 'proportion_test'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_line_style Ran
ran on a synthesized input
LARG/regression-importance-sampling/gridworld/plot_gridworld.py
code served (permissive licence) · get_code("b091909b63a6904a")
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 LineStyle. 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.

plottype = 'gw-baselines'

class LineStyle(object):
    """Parameters of line."""

    def __init__(self, style, color, width, marker=None, markersize=None, dashes=None, alpha=0.5):
        self.color = color
        self.style = style
        self.width = width
        self.marker = marker
        self.markersize = markersize
        self.dashes = dashes
        self.alpha = alpha

def get_line_style(label):
    """Get line style for line label."""
    lower = label.lower()
    if plottype in ['gw-baselines', 'gw-all-baselines']:
        if 'dr' in lower and 'wdr' not in lower:
            style = LineStyle('-', 'c', 2, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '--'
            return style
        if 'wdr' in lower:
            style = LineStyle(':', 'g', 3, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '-.'
            return style
        if lower == 'ois' or lower == 'ris':
            style = LineStyle('--', 'b', 3, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '-'
            return style
        if 'wis' in lower:
            style = LineStyle('-.', 'r', 3, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '--'
            return style
        if 'pdis' in lower:
            style = LineStyle('--', 'k', 2, alpha=0.35)
            if 'ris' in lower:
                style.width = 5
                style.style = '-'
            return style
    elif 'independent' in lower:
        return LineStyle('-.', 'c', 3, alpha=0.25)
    elif 'extra' in lower:
        return LineStyle(':', 'k', 4, alpha=0.25)
    elif lower.startswith('ris'):
        return LineStyle('-', 'b', 3, alpha=0.25)
    elif lower == 'ois':
        return LineStyle('--', 'r', 3, alpha=0.25)
    else:
        return LineStyle('--', 'k', 2, alpha=0.25)

ARGS = {
    'label': 'DR'
}
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 LineStyle — a LineStyle output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LineStyle 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
p_basis Ran
ran on a synthesized input
LARG/regression-importance-sampling/lds/lds.py
code served (permissive licence) · get_code("678d25d056db0a3a")
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 (24,) 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

# The function p_basis takes:
# - x: an array that will be raised to various powers
# - orders: a list of exponents to apply
#
# Looking at the body:
# - x is used with np.power(x, o) for each o in orders
# - The results are concatenated along axis=0
# - Then flattened
# 
# For np.power to work meaningfully and concatenation along axis=0 to make sense,
# x should be a 2D array where axis=0 is the batch dimension.

# Create a small 2D input array (batch_size=2, feature_dim=4)
x = np.array([[1.0, 2.0, 3.0, 4.0],
              [5.0, 6.0, 7.0, 8.0]])

orders = [1, 2, 3]

ARGS = {
    'x': x,
    'orders': orders
}
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 (24,) — shape (24,) 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
eval_pi_loss Not yet run
unverified (harvested, no recorded run)
LARG/regression-importance-sampling/roboschool-experiments/fit_dist_mse.py
code served (permissive licence) · get_code("b15160ad6ba91572")
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 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

We consider the problem of off-policy evaluation in Markov decision processes. Off-policy evaluation is the task of evaluating the expected return of one policy with data generated by a different, behavior policy. Importance sampling is a technique for off-policy evaluation that re-weights off-policy returns to account for differences in the likelihood of the returns between the two policies. In this paper, we study importance sampling with an estimated behavior policy where the behavior policy estimate comes from the same set of data used to compute the importance sampling estimate. We find that this estimator often lowers the mean squared error of off-policy evaluation compared to importance sampling with the true behavior policy or using a behavior policy that is estimated from a separate data set. Intuitively, estimating the behavior policy in this way corrects for error due to sampling in the action-space. Our empirical results also extend to other popular variants of importance sampling and show that estimating a non-Markovian behavior policy can further lower large-sample mean squared error even when the true behavior policy is Markovian.

For agents

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

get_harvested_code_for_paper("1806.01347")
get_code_for_paper("1806.01347")
have("1806.01347")

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

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

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

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

Connect an agent — have() is free.