SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2301.10330 · NeurIPS · 2022

Off-Policy Evaluation for Action-Dependent Non-Stationary Environments

Emma Brunskill, Yash Chandak, Shiv Shankar, Philip Thomas, Bruno Castro Da Silva, Nathaniel Bastian

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 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; 0 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/2301.10330.json · badge: /api/ran/2301.10330.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
yashchandak/activens canonical (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
FunctionStatusWhere it lives
Base Ran
ran on a synthesized input · constructed an object; no result was computed
yashchandak/activens/Src/OPE/hybrid.py
code served (permissive licence) · get_code("74f7ff9e7e9a69ab")
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 an instance of its own class, Base: the run constructed the object and did not call it, so no result was computed. 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

class Base(object):

    def __init__(self):
        pass

    def get_feats(self, X, p):
        n = len(X)
        feats = np.ones((n - p + 1, p))
        for idx in range(n - p + 1):
            feats[idx, :p] = X[idx:idx + p, 0]
        return feats

    def get_rho_perf(self, data):
        """
        Assumes data structure in array with following dimensions

        #Traj x #Horizon length x 2 (i.e., rho and reward)
        """
        per_step_rho = data[:, :, 0]
        per_step_rewards = data[:, :, 1]
        rho = np.prod(per_step_rho, axis=1, keepdims=True)
        perf = np.sum(per_step_rewards, axis=1, keepdims=True)
        return (rho, perf / self.max_G)


# Create instance and test setup
base_instance = Base()
base_instance.max_G = 10.0

# Test data for get_feats: X should be 2D array with shape (n, 1) or similar
X_data = np.array([[1.0], [2.0], [3.0], [4.0], [5.0]])
p_value = 3

# Test data for get_rho_perf: 3D array with shape (#Traj, #Horizon, 2)
# Shape: (2 trajectories, 4 horizon steps, 2 values per step)
data_rho_perf = np.array([
    [[0.9, 1.0], [0.8, 2.0], [0.7, 1.5], [0.6, 2.5]],
    [[0.95, 0.5], [0.85, 1.5], [0.75, 2.0], [0.65, 1.0]]
])

ARGS = {
}
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 Base — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Base 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
BasicFit Ran
ran on a synthesized input · constructed an object; no result was computed
yashchandak/activens/Src/OPE/hybrid.py
code served (permissive licence) · get_code("413e927aa100cd89")
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 an instance of its own class, BasicFit: the run constructed the object and did not call it, so no result was computed. 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

torch.manual_seed(0)

ARGS = {}
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 BasicFit — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BasicFit 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
Linear Ran
ran on a synthesized input · constructed an object; no result was computed
yashchandak/activens/Src/OPE/hybrid.py
code served (permissive licence) · get_code("45949d2a6e389c3c")
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 an instance of its own class, Linear: the run constructed the object and did not call it, so no result was computed. 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
from torch import tensor
import torch.nn as nn

torch.manual_seed(0)

class BasicFit(nn.Module):
    def __init__(self):
        super().__init__()

class Linear(BasicFit):
    def __init__(self, p):
        super().__init__()
        self.layer1 = nn.Linear(p, 1)

    def forward(self, x):
        if not isinstance(x, torch.Tensor):
            x = tensor(x).float()
        return self.layer1(x)

ARGS = {
    'p': 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 Linear — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Linear 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
OPEN_1 Ran
ran on a synthesized input · constructed an object; no result was computed
yashchandak/activens/Src/OPE/hybrid.py
code served (permissive licence) · get_code("3ffd60654c5498fd")
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 an instance of its own class, OPEN_1: the run constructed the object and did not call it, so no result was computed. 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
from torch import tensor
import torch.nn as nn

torch.manual_seed(0)

# First, we need to add a fit method to Linear since twoSLS calls self.S1.fit() and self.S2.fit()
class Linear(nn.Module):
    def __init__(self, p):
        super().__init__()
        self.layer1 = nn.Linear(p, 1)
    
    def forward(self, x):
        if not isinstance(x, torch.Tensor):
            x = tensor(x).float()
        return self.layer1(x)
    
    def fit(self, x, y):
        # Dummy fit method - does nothing but allows the code to run
        pass

# Create instance of OPEN_1
# Looking at the code:
# - __init__ takes p (default 100)
# - twoSLS uses get_rho_perf which accesses self.max_G, so Base needs max_G
# - get_feats is called with X and p
# - S1 and S2 are Linear models with parameter p

class Base(object):
    def __init__(self):
        self.max_G = 1.0
    
    def get_feats(self, X, p):
        n = len(X)
        feats = np.ones((n - p + 1, p))
        for idx in range(n - p + 1):
            feats[idx, :p] = X[idx:idx + p, 0]
        return feats
    
    def get_rho_perf(self, data):
        per_step_rho = data[:, :, 0]
        per_step_rewards = data[:, :, 1]
        rho = np.prod(per_step_rho, axis=1, keepdims=True)
        perf = np.sum(per_step_rewards, axis=1, keepdims=True)
        return (rho, perf / self.max_G)

class BasicFit(nn.Module):
    def __init__(self):
        super().__init__()

class OPEN_1(Base):
    def __init__(self, p=100) -> None:
        super().__init__()
        self.S1 = Linear(p)
        self.S2 = Linear(p)
        self.p = p
    
    def twoSLS(self, data):
        rho, perf = self.get_rho_perf(data)
        p = self.p
        X = rho * perf
        X_feats = self.get_feats(X, p)
        self.S1.fit(x=X_feats[:-1], y=X[p:])
        X_bar = self.S1(X_feats[:-1]).detach().numpy()
        X_bar_feats = self.get_feats(X_bar, p)
        rho2 = rho[2 * p - 1:-1] * rho[2 * p:]
        self.S2.fit(x=X_bar_feats[:-1], y=rho2 * perf[2 * p:])
        return (X, X_bar, X_bar_feats)
    
    def predict(self, data, k, past=False):
        X, X_bar, X_bar_feats = self.twoSLS(data)
        p = self.p
        temp = np.zeros(k + p)
        temp[:p] = X_bar_feats[-1][:p]
        for idx in range(k):
            feats = np.ones(p)
            feats[:p] = temp[idx:idx + p]
            temp[idx + p] = self.S2(feats).item()
        if past:
            return (temp[p:], X_bar.reshape(-1))
        else:
            return temp[p:]

# Create valid arguments
p = 5
# Need data with shape: #Traj x #Horizon length x 2
# For twoSLS to work properly with indexing at 2*p-1 and 2*p, 
# we need horizon length > 2*p
# Let's use horizon = 20 (> 2*5 = 10), and 3 trajectories
data = np.random.rand(3, 20, 2).astype(np.float32)

ARGS = {
    'p': p
}
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 OPEN_1 — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a OPEN_1 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

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

Methods for sequential decision-making are often built upon a foundational assumption that the underlying decision process is stationary. This limits the application of such methods because real-world problems are often subject to changes due to external factors (passive non-stationarity), changes induced by interactions with the system itself (active non-stationarity), or both (hybrid non-stationarity). In this work, we take the first steps towards the fundamental challenge of on-policy and off-policy evaluation amidst structured changes due to active, passive, or hybrid non-stationarity. Towards this goal, we make a higher-order stationarity assumption such that non-stationarity results in changes over time, but the way changes happen is fixed. We propose, OPEN, an algorithm that uses a double application of counterfactual reasoning and a novel importance-weighted instrument-variable regression to obtain both a lower bias and a lower variance estimate of the structure in the changes of a policy's past performances. Finally, we show promising results on how OPEN can be used to predict future performances for several domains inspired by real-world applications that exhibit non-stationarity. How can one provide a unified procedure for (off) policy evaluation amidst active, passive, or hybrid non-stationarity, when the underlying changes are structured? Contributions: To the best of our knowledge, our work presents the first steps towards addressing the fundamental challenge of off-policy evaluation amidst structured changes due to active or hybrid non-stationarity. Towards this goal, we make a higher-order stationarity assumption, under which the non-stationarity can result in changes over time, but the way changes happen is fixed. Under this assumption, we propose a model-free method that can infer the effect of the underlying nonstationarity on the past performances and use that to predict the future performances for a given policy. We call the proposed method OPEN: off-policy evaluation for non-stationary domains. On domains inspired by real-world applications, we show that OPEN often provides significantly better results not only in the presence of active and hybrid non-stationarity, but also for the passive setting where it even outperforms previous methods designed to handle only passive non-stationarity. OPEN primarily relies upon two key insights: (a) For active/hybrid non-stationarity, as the underlying changes may dependend on past interactions, the structure in the changes observed when executing the data collection policy can be different than if one were to execute the evaluation policy. To address this challenge, OPEN makes uses counterfactual reasoning twice and permits reduction of this off-policy evaluation problem to an auto-regression based forecasting problem. (b) Despite reduction to a more familiar auto-regression problem, in this setting naive least-squares based estimates of parameters for auto-regression suffers from high variance and can even be asymptotically biased. Finally, to address this challenge, OPEN uses a novel importance-weighted instrument-variable (auto-)regression technique to obtain asymptotically consistent and lower variance parameter estimates.

For agents

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

get_harvested_code_for_paper("2301.10330")
get_code_for_paper("2301.10330")
have("2301.10330")

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

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

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

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

Connect an agent — have() is free.