| CondEpsNet |
Ran ran on a synthesized input |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("97a9f68b697701d9") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 1) 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 math
import torch.nn as nn
import torch.nn.functional as F
class TimeEmbedding(nn.Module):
def __init__(self, dim: int):
super().__init__()
self.dim = int(dim)
self.lin1 = nn.Linear(self.dim, self.dim)
self.lin2 = nn.Linear(self.dim, self.dim)
def forward(self, t: torch.Tensor) -> torch.Tensor:
if t.dim() == 1:
t = t[:, None]
half = self.dim // 2
freqs = torch.exp(torch.linspace(0, math.log(10000), steps=half, device=t.device))
args = t * freqs
emb = torch.cat([torch.sin(args), torch.cos(args)], dim=-1)
emb = F.silu(self.lin1(emb))
return self.lin2(emb)
class CondEpsNet(nn.Module):
def __init__(self, x_dim: int, hidden: int, t_dim: int):
super().__init__()
self.t_embed = TimeEmbedding(t_dim)
self.x_enc = nn.Sequential(nn.Linear(x_dim, hidden), nn.SiLU(), nn.Linear(hidden, hidden), nn.SiLU())
self.y_in = nn.Linear(1, hidden)
self.fc = nn.Sequential(nn.Linear(hidden + hidden + t_dim, hidden), nn.SiLU(), nn.Linear(hidden, hidden), nn.SiLU(), nn.Linear(hidden, 1))
def forward(self, y_t: torch.Tensor, t_cont: torch.Tensor, x: torch.Tensor) -> torch.Tensor:
t_emb = self.t_embed(t_cont.view(-1))
xh = self.x_enc(x)
yh = self.y_in(y_t)
h = torch.cat([xh, yh, t_emb], dim=-1)
return self.fc(h)
INIT_ARGS = {
'x_dim': 4,
'hidden': 8,
't_dim': 6,
}
ARGS = {
'y_t': torch.randn(2, 1),
't_cont': torch.randn(2),
'x': torch.randn(2, 4),
}
if __name__ == '__main__':
model = CondEpsNet(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output: {output}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- 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, 1) — shape (2, 1) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| KnnDensityHelper |
Ran ran on a synthesized input |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("9f70f55965dff86a") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned ndarray, ndim 1, dtype family float, shape (2,) 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
from sklearn.neighbors import NearestNeighbors
def _as_2d(arr: np.ndarray) -> np.ndarray:
arr = np.asarray(arr, dtype=np.float32)
if arr.ndim == 1:
return arr[None, :]
return arr
class KnnDensityHelper:
def __init__(self, x_train: np.ndarray, max_k: int, *, transform=None):
self.transform = transform
x_fit = transform(x_train) if transform is not None else x_train
x_fit = _as_2d(x_fit)
self.x = x_fit
self.dim = x_fit.shape[1]
self.n = x_fit.shape[0]
self.nn = NearestNeighbors(n_neighbors=max_k).fit(x_fit)
self.max_k = int(max_k)
def _apply(self, x_query: np.ndarray) -> np.ndarray:
return self.transform(x_query) if self.transform is not None else x_query
def log_rk(self, x_query: np.ndarray, k: int) -> np.ndarray:
x_query = _as_2d(x_query)
x_query = self._apply(x_query)
k = int(k)
if k <= 0 or k > self.max_k:
raise ValueError(f'Invalid k={k} for kNN helper (max_k={self.max_k}).')
dists = self.nn.kneighbors(x_query, n_neighbors=k, return_distance=True)[0]
r_k = dists[:, -1] + 1e-08
return np.log(r_k)
INIT_ARGS = {
'x_train': np.random.randn(8, 4).astype(np.float32),
'max_k': 5,
'transform': None,
}
ARGS = {
'x_query': np.random.randn(2, 4).astype(np.float32),
'k': 3,
}
METHOD = 'log_rk'
if __name__ == '__main__':
helper = KnnDensityHelper(**INIT_ARGS)
result = helper.log_rk(**ARGS)
print(f"Result shape: {result.shape}")
print(f"Result: {result}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- numpy, sklearn — 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 (2,) — shape (2,) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| ScalarDiffusionSurrogate |
Ran ran on a synthesized input |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("681458c13d0167a2") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, 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 math
import torch.nn as nn
import torch.nn.functional as F
# Define INIT_ARGS for ScalarDiffusionSurrogate.__init__
INIT_ARGS = {
'x_dim': 4,
'steps': 10,
'hidden': 8,
't_dim': 6,
'beta_start': 0.0001,
'beta_end': 0.02,
'device': torch.device('cpu'),
}
# Define ARGS for the computation method (loss)
ARGS = {
'x': torch.randn(2, 4),
'y': torch.randn(2, 1),
}
# Define the method to call
METHOD = 'loss'
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- 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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| TimeEmbedding |
Ran ran on a synthesized input |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("4cf430efa36c0fb8") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) 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
import math
import torch.nn as nn
import torch.nn.functional as F
class TimeEmbedding(nn.Module):
def __init__(self, dim: int):
super().__init__()
self.dim = int(dim)
self.lin1 = nn.Linear(self.dim, self.dim)
self.lin2 = nn.Linear(self.dim, self.dim)
def forward(self, t: torch.Tensor) -> torch.Tensor:
if t.dim() == 1:
t = t[:, None]
half = self.dim // 2
freqs = torch.exp(torch.linspace(0, math.log(10000), steps=half, device=t.device))
args = t * freqs
emb = torch.cat([torch.sin(args), torch.cos(args)], dim=-1)
emb = F.silu(self.lin1(emb))
return self.lin2(emb)
INIT_ARGS = {
'dim': 4
}
ARGS = {
't': torch.randn(2)
}
if __name__ == '__main__':
model = TimeEmbedding(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output: {output}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| _as_2d |
Ran ran, honoured the contract we drafted |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("80a38ab4a9fb9601") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 2, dtype family float, shape (1, 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
# Test case 1: 1D array (should be converted to 2D)
arr_1d = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float32)
# Test case 2: 2D array (should remain 2D)
arr_2d = np.array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]], dtype=np.float32)
# Use the 1D array as the primary test case
ARGS = {
"arr": arr_1d
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 2, dtype family float, shape (1, 4) — shape (1, 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
|
| _ensure_2d |
Ran ran, honoured the contract we drafted |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("ab5cef763a973407") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 2, dtype family int, shape (5, 1) 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
# Test case 1: 1D array that should be converted to 2D
arr_1d = np.array([1, 2, 3, 4, 5])
# Test case 2: 2D array that should remain unchanged
arr_2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
# Test case 3: List that will be converted to array
arr_list = [10, 20, 30, 40]
# Test case 4: Nested list (2D)
arr_nested = [[1, 2], [3, 4], [5, 6]]
ARGS = {
"arr": arr_1d
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 2, dtype family int, shape (5, 1) — shape (5, 1) 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
|
| acquisition_from_samples |
Ran ran; our contract draft was wrong, not the code |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("4db6557dac754a47") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, 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 torch
import numpy as np
torch.manual_seed(0)
# Create sample data: 2 samples, 4 dimensions
samples = torch.randn(2, 4)
# Set y_best to a reasonable value
y_best = 0.5
# Set acquisition function kind
kind = 'ei'
# Set ucb_beta parameter
ucb_beta = 2.0
# Set ei_xi parameter (expected improvement exploration parameter)
ei_xi = 0.1
# Set mvr_lambda parameter (mean-variance regularization)
mvr_lambda = 0.5
ARGS = {
'samples': samples,
'y_best': y_best,
'kind': kind,
'ucb_beta': ucb_beta,
'ei_xi': ei_xi,
'mvr_lambda': mvr_lambda,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, 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
|
| apply_support_transform |
Ran ran; our contract draft was wrong, not the code |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("855e6bffce251fe6") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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)
# Create sample tensors
# samples: shape (batch_size, feature_dim) - used for mean/std computation
samples = torch.randn(2, 4)
# log_rk: shape (n_features,) or broadcastable - used for adjustment calculations
log_rk = torch.randn(4)
# Scalar parameters
tau_a = 0.5
sigma_a0 = 0.1
sigma_a1 = 0.2
ARGS = {
"samples": samples,
"log_rk": log_rk,
"tau_a": tau_a,
"sigma_a0": sigma_a0,
"sigma_a1": sigma_a1,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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
|
| build_knn_helper |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("71870850a265ad4e") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned KnnDensityHelper. 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 typing import Callable, Sequence
def dummy_transform(x: np.ndarray) -> np.ndarray:
"""Simple transform that scales data by 2"""
return x * 2.0
# Create small training data: 5 samples, 3 features
x_train = np.random.randn(5, 3).astype(np.float32)
# Define k_list with valid values
k_list = [1, 2, 3]
# Define transform as None or a callable
transform = None
ARGS = {
"x_train": x_train,
"k_list": k_list,
"transform": transform,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type KnnDensityHelper — a KnnDensityHelper output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a KnnDensityHelper 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
|
| clip_and_renorm |
Ran ran, honoured the contract we drafted |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("d1fe61e95e0ab9cf") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, 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 numpy as np
# Set up small numpy arrays for the function parameters
# x_norm: normalized input array (batch_size=2, features=4)
x_norm = np.array([
[0.5, -0.3, 1.2, -0.8],
[0.1, 0.4, -0.6, 0.9]
], dtype=np.float32)
# bounds: shape (4, 2) - lower and upper bounds for each feature
bounds = np.array([
[-1.0, 1.0],
[-2.0, 2.0],
[-0.5, 0.5],
[-1.5, 1.5]
], dtype=np.float32)
# x_mean: mean for each feature (4,)
x_mean = np.array([0.1, 0.2, -0.1, 0.05], dtype=np.float32)
# x_std: standard deviation for each feature (4,)
x_std = np.array([0.5, 0.8, 0.3, 0.6], dtype=np.float32)
ARGS = {
"x_norm": x_norm,
"bounds": bounds,
"x_mean": x_mean,
"x_std": x_std
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 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
|
| clip_to_bounds |
Ran ran, honoured the contract we drafted |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("d01936d34e41a35c") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, 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 numpy as np
# Create a small input array with shape (2, 4)
x = np.array([
[-1.0, 0.5, 2.0, 10.0],
[0.0, 1.5, 3.0, 5.0]
], dtype=np.float32)
# Create bounds array with shape (4, 2) where each row is [lower, upper]
bounds = np.array([
[-0.5, 0.5], # bounds for dimension 0
[0.0, 1.0], # bounds for dimension 1
[1.0, 2.5], # bounds for dimension 2
[0.0, 4.0] # bounds for dimension 3
], dtype=np.float32)
ARGS = {
"x": x,
"bounds": bounds
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 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
|
| evolutionary_optimize |
Ran ran; our contract draft was wrong, not the code |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("36bd257d56f94f61") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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
from typing import Callable
# Set random seed for reproducibility
np.random.seed(0)
rng = np.random.default_rng(0)
# Define dimensions: feature_dim=4, sample_dim=2
feature_dim = 4
n_samples = 2
# Create training data
x_train = np.random.randn(n_samples, feature_dim).astype(np.float32)
y_train = np.random.randn(n_samples).astype(np.float32)
# Create bounds for each feature (lower and upper bounds)
bounds = np.array([
[-1.0, 1.0],
[-2.0, 2.0],
[-0.5, 0.5],
[-3.0, 3.0]
], dtype=np.float32)
# Create normalization parameters
x_mean = np.mean(x_train, axis=0).astype(np.float32)
x_std = np.std(x_train, axis=0).astype(np.float32) + 1e-8 # avoid division by zero
# Create a simple score function that takes a population and returns scores
def score_fn(pop: np.ndarray) -> np.ndarray:
"""Simple scoring function: sum of features"""
return np.sum(pop, axis=1).astype(np.float32)
ARGS = {
'score_fn': score_fn,
'x_train': x_train,
'y_train': y_train,
'bounds': bounds,
'x_mean': x_mean,
'x_std': x_std,
'rng': rng,
'pop_size': 4,
'elite_size': 2,
'gens': 2,
'mut_sigma_init': 0.1,
'mut_sigma_min': 0.01,
'crossover_rate': 0.5,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- 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
|
| make_beta_schedule |
Ran ran, honoured the contract we drafted |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("146db3f324ec3821") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 1, dtype family float, shape (100,) 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)
ARGS = {
"steps": 100,
"beta_start": 0.0001,
"beta_end": 0.02,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 1, dtype family float, shape (100,) — shape (100,) 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
|
| z_score |
Ran ran; our contract draft was wrong, not the code |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("80a3da03a6fc9ab7") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) 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
# Create a small numpy array with distinct dimensions
# Using shape (2, 4) - batch size 2, feature dimension 4
arr = np.array([
[1.0, 2.0, 3.0, 4.0],
[5.0, 6.0, 7.0, 8.0]
], dtype=np.float32)
ARGS = {
"arr": arr
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- 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
|
| z_score_denorm |
Ran ran, honoured the contract we drafted |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("f39bb60e2d4fae07") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, 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 numpy as np
# Create small test arrays for z-score denormalization
# The function takes normalized data and reverses the z-score normalization
# by multiplying by std and adding mean
arr = np.array([[1.0, 2.0, 3.0, 4.0],
[5.0, 6.0, 7.0, 8.0]], dtype=np.float32)
mean = np.array([10.0, 20.0, 30.0, 40.0], dtype=np.float32)
std = np.array([2.0, 3.0, 4.0, 5.0], dtype=np.float32)
ARGS = {
"arr": arr,
"mean": mean,
"std": std
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 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
|
| Dataset |
Not yet run unverified (harvested, no recorded run) |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("1fe070d1ecb71daf") How it ran |
| OptimizationResult |
Not yet run unverified (harvested, no recorded run) |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("42cd3d3a49f9da3c") How it ran |
| SpadeConfig |
Not yet run unverified (harvested, no recorded run) |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("4d8039a217216ef4") How it ran |
| mc_samples |
Not yet run unverified (harvested, no recorded run) |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("47bdbaeb1cc4a7f4") How it ran |
| optimize_spade |
Not yet run unverified (harvested, no recorded run) |
HarryYoung2018/spade/spade/optimize.py code served (permissive licence) · get_code("3ddf62b9dc3c9a75") How it ran |