SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1806.04225 · 2018

PAC-Bayes Control: Learning Policies that Provably Generalize to Novel Environments

arXiv · PDF · Open in the Atlas

Code that ran

6 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 6 have no contract verdict; 0 failures of our instrument; 4 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.04225.json · badge: /api/ran/1806.04225.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
irom-lab/PAC-Bayes-Control canonical (classifier label)
classifier basis: census
6 ran · 4 no recorded run
FunctionStatusWhere it lives
expected_cost Ran
ran on a synthesized input
irom-lab/PAC-Bayes-Control/Extension-Domain_Shifts/utils.py
code served (permissive licence) · get_code("2fb362e87fc95efa")
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 numpy as np

# Based on the function signature and body:
# - p: a 1D array of probabilities/weights that will be matrix-multiplied
# - precomputed_costs: a 2D array where each row is costs for an environment
#   The matmul(precomputed_costs, p) produces costs_envs
#   Then np.mean is taken over costs_envs

# For matmul to work: precomputed_costs shape (m, n) @ p shape (n,) -> (m,)
# Let's use distinct dimensions: 5 environments, 3 probability values

np.random.seed(0)

p = np.array([0.2, 0.3, 0.5])  # Shape (3,) - probability distribution
precomputed_costs = np.array([
    [1.0, 2.0, 3.0],
    [0.5, 1.5, 2.5],
    [2.0, 3.0, 4.0],
    [1.2, 1.8, 2.4],
    [0.8, 1.2, 1.6]
])  # Shape (5, 3) - costs for 5 environments over 3 choices

ARGS = {
    "p": p,
    "precomputed_costs": precomputed_costs
}
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 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
generate_obstacles Ran
ran on a synthesized input
irom-lab/PAC-Bayes-Control/utils_simulation.py
code served (permissive licence) · get_code("bcfb58b7ccbd0875")
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 int, ndim 0, dtype family int, 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

# Mock PyBullet physics client with required methods
class MockPhysicsClient:
    def __init__(self):
        self.JOINT_FIXED = 4
        self.GEOM_CYLINDER = 3
        self.GEOM_BOX = 1
        self._collision_shape_counter = 0
    
    def createCollisionShape(self, shape_type, radius=None, height=None, halfExtents=None):
        # Return a unique collision shape ID
        shape_id = self._collision_shape_counter
        self._collision_shape_counter += 1
        return shape_id
    
    def createMultiBody(self, baseCollisionShapeIndex, baseVisualShapeIndex, 
                       basePosition, baseOrientation, baseInertialFramePosition,
                       baseInertialFrameOrientation, linkMasses, linkCollisionShapeIndices,
                       linkVisualShapeIndices, linkPositions, linkOrientations,
                       linkParentIndices, linkInertialFramePositions, 
                       linkInertialFrameOrientations, linkJointTypes, linkJointAxis):
        # Return a unique body UID
        return 0

# Create a mock physics client
p = MockPhysicsClient()

# Set up the function arguments
ARGS = {
    'p': p,
    'heightObs': 0.5,
    'robotRadius': 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 int, ndim 0, dtype family int, 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
kl_divergence Ran
ran on a synthesized input
irom-lab/PAC-Bayes-Control/Extension-Domain_Shifts/utils.py
code served (permissive licence) · get_code("cbbc4f939b2eef2f")
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 numpy as np

# Setup for kl_divergence function
# The function expects two probability distributions p and q
# They can be either scalars (converted to [p, 1-p] and [q, 1-q])
# or sequences of probabilities

# Test case 1: Using scalar probabilities
p_scalar = 0.7
q_scalar = 0.6

# Test case 2: Using array/list probabilities (normalized)
p_array = np.array([0.3, 0.4, 0.3])
q_array = np.array([0.25, 0.5, 0.25])

# The function will work with either format
# Using the scalar case for simplicity
ARGS = {
    "p": 0.7,
    "q": 0.6
}
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 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
kl_inverse Ran
ran on a synthesized input
irom-lab/PAC-Bayes-Control/optimize_PAC_bound.py
code served (permissive licence) · get_code("792b054090d3d04d")
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 cvxpy as cvx
import numpy as np

# Looking at the function kl_inverse(q, c):
# - q: used as a scalar in np.array([q, 1 - q]), so needs to be a float/int between 0 and 1
# - c: used as a scalar in constraint "c >= cvx.sum(...)", so needs to be a float/int >= 0

ARGS = {
    "q": 0.3,
    "c": 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cvxpy, 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
optimize_PAC_bound Ran
ran on a synthesized input
irom-lab/PAC-Bayes-Control/optimize_PAC_bound.py
code served (permissive licence) · get_code("b784191da03032db")
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

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

# Parameters for optimize_PAC_bound
# costs_precomputed: shape (m, L) - empirical costs for m samples and L hypotheses
m = 5  # number of samples
L = 4  # number of hypotheses
costs_precomputed = np.random.rand(m, L)

# p0: initial probability distribution over L hypotheses
p0 = np.ones(L) / L

# delta: confidence parameter
delta = 0.1

ARGS = {
    "costs_precomputed": costs_precomputed,
    "p0": p0,
    "delta": delta,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cvxpy, numpy — 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
robot_update_state Ran
ran on a synthesized input
irom-lab/PAC-Bayes-Control/utils_simulation.py
code served (permissive licence) · get_code("1367ffaf9c43fa2c")
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 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

# The function takes a state (list of 3 floats) and u_diff (a scalar or array)
# state represents [x, y, theta] position and orientation
# u_diff is the differential input to the robot controller

state = [0.0, 1.5, 0.785]  # Initial state: x=0, y=1.5, theta=0.785 rad

u_diff = 0.1  # Differential control input (scalar)

ARGS = {
    "state": state,
    "u_diff": u_diff
}
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 list, ndim 1, dtype family float — 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
getDistances Not yet run
unverified (harvested, no recorded run)
irom-lab/PAC-Bayes-Control/utils_simulation.py
code served (permissive licence) · get_code("18f46646194cedc3")
How it ran

no invocation recorded.

kl_inverse_l Not yet run
unverified (harvested, no recorded run)
irom-lab/PAC-Bayes-Control/Extension-Domain_Shifts/utils.py
code served (permissive licence) · get_code("4f716bb619cd86fa")
How it ran

no invocation recorded.

optimize_PAC_bound_MPB Not yet run
unverified (harvested, no recorded run)
irom-lab/PAC-Bayes-Control/Extension-Domain_Shifts/optimize_PAC_bound.py
code served (permissive licence) · get_code("aa0698dcefebb731")
How it ran

no invocation recorded.

optimize_PAC_bound_NPB Not yet run
unverified (harvested, no recorded run)
irom-lab/PAC-Bayes-Control/Extension-Domain_Shifts/optimize_PAC_bound.py
code served (permissive licence) · get_code("7c22ea7dcb0a20d8")
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

Our goal is to learn control policies for robots that provably generalize well to novel environments given a dataset of example environments. The key technical idea behind our approach is to leverage tools from generalization theory in machine learning by exploiting a precise analogy (which we present in the form of a reduction) between generalization of control policies to novel environments and generalization of hypotheses in the supervised learning setting. In particular, we utilize the Probably Approximately Correct (PAC)-Bayes framework, which allows us to obtain upper bounds that hold with high probability on the expected cost of (stochastic) control policies across novel environments. We propose policy learning algorithms that explicitly seek to minimize this upper bound. The corresponding optimization problem can be solved using convex optimization (Relative Entropy Programming in particular) in the setting where we are optimizing over a finite policy space. In the more general setting of continuously parameterized policies (e.g., neural network policies), we minimize this upper bound using stochastic gradient descent. We present simulated results of our approach applied to learning (1) reactive obstacle avoidance policies and (2) neural network-based grasping policies. We also present hardware results for the Parrot Swing drone navigating through different obstacle environments. Our examples demonstrate the potential of our approach to provide strong generalization guarantees for robotic systems with continuous state and action spaces, complicated (e.g., nonlinear) dynamics, rich sensory inputs (e.g., depth images), and neural network-based policies.

For agents

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

get_harvested_code_for_paper("1806.04225")
get_code_for_paper("1806.04225")
have("1806.04225")

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

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

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

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

Connect an agent — have() is free.