| ExamComposition |
Ran ran on a synthesized input · constructed an object; no result was computed |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("6fdf6553ceeed2b5") How it ranRan 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, ExamComposition: 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.
from dataclasses import dataclass
from typing import Dict, List, Optional
ARGS = {
'name': 'weighted_policy_v1',
'scene_sampling': 'uniform',
'task_family_weights': {
'family_a': 0.5,
'family_b': 0.3,
'family_c': 0.2,
},
'task_family_weights_by_structure_label': {
'structure_1': {'family_a': 0.6, 'family_b': 0.4},
'structure_2': {'family_a': 0.2, 'family_c': 0.8},
},
'output_variant_weights_by_family': {
'family_a': {'variant_1': 0.7, 'variant_2': 0.3},
'family_b': {'variant_1': 0.5, 'variant_2': 0.5},
},
'observation_variant_weights': {
'obs_easy': 0.4,
'obs_medium': 0.35,
'obs_hard': 0.25,
},
'observation_variant_weights_by_family': {
'family_a': {'obs_easy': 0.6, 'obs_hard': 0.4},
},
'observation_variant_order': [
'obs_easy',
'obs_medium',
'obs_hard',
],
'difficulty': 0.5,
'rung_tilt_strength': 1.0,
'output_variant_tilt_strength': 1.0,
'obs_tilt_strength': 1.0,
'max_scene_resamples': 4,
'allow_silent_renorm': True,
}
- 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 ExamComposition — 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 ExamComposition 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
|
| TaskType |
Ran ran on a synthesized input · constructed an object; no result was computed |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("e0d77746002a838d") How it ranRan 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, TaskType: 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 enum import Enum
class TaskType(str, Enum):
"""Question family (semantic intent)."""
PREDICTION = 'prediction'
ASSOCIATION = 'association'
COLLIDER_PHENOMENON = 'collider_phenomenon'
CAUSAL_SKETCH = 'causal_sketch'
IDENTIFICATION = 'identification'
EFFECT_ESTIMATE = 'effect_estimate'
BIAS_DIAGNOSTIC = 'bias_diagnostic'
COUNTERFACTUAL_IDENTIFICATION = 'counterfactual_identification'
COUNTERFACTUAL_EFFECT = 'counterfactual_effect'
MEDIATION_EFFECT = 'mediation_effect'
def __str__(self) -> str:
return self.value
torch.manual_seed(0)
ARGS = {
'value': 'prediction'
}
- 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 TaskType — 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 TaskType 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
|
| _apply_obs_tilt |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("471a02e4534852ff") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import math
from typing import Any, Dict, List, Optional
# Construct valid arguments for _apply_obs_tilt
# weights: Dict[Any, float] - a dictionary mapping observation keys to their weights
weights = {
"obs_easy": 1.0,
"obs_medium": 2.0,
"obs_hard": 3.0,
"obs_other": 0.5
}
# gamma: float - the tilt coefficient
gamma = 0.5
# difficulty: float - the difficulty parameter (typically between 0 and 1)
difficulty = 0.7
# obs_order: Optional[List[str]] - ordered list of observation names (easiest first)
obs_order = ["obs_easy", "obs_medium", "obs_hard"]
ARGS = {
"weights": weights,
"gamma": gamma,
"difficulty": difficulty,
"obs_order": obs_order
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| _apply_output_variant_tilt |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("e5dd3c76df618a46") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import math
from typing import Dict, List, Optional
from enum import Enum
class OutputVariant(str, Enum):
"""Output contract for a question family."""
UNKNOWN = 'unknown'
POINT_PREDICTOR = 'point_predictor'
PREDICTION_INTERVAL = 'prediction_interval'
SIGN_ONLY = 'sign_only'
EFFECT_SIZE_POINT = 'effect_size_point'
SIGN_BEFORE_AFTER = 'sign_before_after'
DELTA_POINT = 'delta_point'
DELTA_SIGN_ONLY = 'delta_sign_only'
ARGMAX_CHANGE = 'argmax_change'
INDUCED_ASSOCIATION_BOOLEAN = 'induced_association_boolean'
INDUCED_ASSOCIATION_SIGN_ONLY = 'induced_association_sign_only'
INDUCED_ASSOCIATION_STRENGTH_POINT = 'induced_association_strength_point'
EDGES_ONLY = 'edges_only'
SKELETON_EDGES = 'skeleton_edges'
ONE_VALID_ADJUSTMENT_SET = 'one_valid_adjustment_set'
IDENTIFIABLE_BOOLEAN = 'identifiable_boolean'
METHOD_LABEL = 'method_label'
MINIMAL_ADJUSTMENT_SET_SIZE = 'minimal_adjustment_set_size'
N_VALID_ADJUSTMENT_SETS = 'n_valid_adjustment_sets'
ALL_MINIMAL_ADJUSTMENT_SETS = 'all_minimal_adjustment_sets'
ATE_POINT = 'ate_point'
ATE_UQ_95 = 'ate_uq_95'
ATE_SIGN_ONLY = 'ate_sign_only'
ATE_VS_ASSOC_SIGN_MATCH = 'ate_vs_assoc_sign_match'
COLLIDER_BIAS_BOOLEAN = 'collider_bias_boolean'
FORBIDDEN_CONTROLS_LIST = 'forbidden_controls_list'
EFFECT_POINT = 'effect_point'
EFFECT_UQ_95 = 'effect_uq_95'
DIRECT_VS_INDIRECT_DOMINANCE = 'direct_vs_indirect_dominance'
def __str__(self) -> str:
return self.value
weights = {
OutputVariant.POINT_PREDICTOR: 0.5,
OutputVariant.SIGN_ONLY: 0.3,
OutputVariant.PREDICTION_INTERVAL: 0.2,
}
delta = 0.5
difficulty = 0.7
variant_order = [
OutputVariant.POINT_PREDICTOR,
OutputVariant.SIGN_ONLY,
OutputVariant.PREDICTION_INTERVAL,
]
ARGS = {
"weights": weights,
"delta": delta,
"difficulty": difficulty,
"variant_order": variant_order,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| _portable_repo_path |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("7eb5370f70e56a33") How it ranRan 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.
from pathlib import Path
from typing import Any, Dict, List, Optional
# The function _portable_repo_path takes a single parameter 'path' of type Any
# It converts the path to a Path object, then tries to make it relative to the repo root
# We need to provide a valid path argument
# Create a test path - we'll use a relative path that could exist in a repo
test_path = Path("src/module/file.py")
ARGS = {
"path": test_path
}
- 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 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
|
| _read_scene_structure_label |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("25b539302a57ef8b") How it ranRan 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 json
import tempfile
from pathlib import Path
# Create a temporary directory structure to simulate the benchmark_dir
temp_dir = tempfile.mkdtemp()
benchmark_dir = Path(temp_dir)
# Create the scenes_private subdirectory structure
scene_id = "test_scene_001"
private_scene_dir = benchmark_dir / 'scenes_private' / scene_id
private_scene_dir.mkdir(parents=True, exist_ok=True)
# Create a ground_truth.json file with test data
ground_truth_data = {
"metadata": {
"structural_label": "test_structure",
"motif": "test_motif"
},
"graph": {
"augmentation": {
"applied_grafts": 2
},
"auxiliary_graph_grafts": [],
"main_graph": {
"motif": "main_motif"
}
}
}
gt_path = private_scene_dir / 'ground_truth.json'
with open(gt_path, 'w') as f:
json.dump(ground_truth_data, f)
ARGS = {
'benchmark_dir': benchmark_dir,
'scene_id': scene_id
}
- 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 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
|
| _resolve_family_weights |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("cd7aca1869f92036") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import logging
from typing import Any, Dict, List, Optional
from enum import Enum
class TaskType(str, Enum):
"""Question family (semantic intent)."""
PREDICTION = 'prediction'
ASSOCIATION = 'association'
COLLIDER_PHENOMENON = 'collider_phenomenon'
CAUSAL_SKETCH = 'causal_sketch'
IDENTIFICATION = 'identification'
EFFECT_ESTIMATE = 'effect_estimate'
BIAS_DIAGNOSTIC = 'bias_diagnostic'
COUNTERFACTUAL_IDENTIFICATION = 'counterfactual_identification'
COUNTERFACTUAL_EFFECT = 'counterfactual_effect'
MEDIATION_EFFECT = 'mediation_effect'
def __str__(self) -> str:
return self.value
logger = logging.getLogger(__name__)
def parse_task_type(value: Any) -> TaskType:
"""Parse a task type into a TaskType enum."""
if isinstance(value, TaskType):
return value
if isinstance(value, str):
v = value.strip().lower()
return TaskType(v)
raise ValueError(f'Unrecognized task_type: {value!r}')
def _resolve_family_weights(comp: 'ExamComposition', scene_structure_label: Optional[str]) -> Optional[Dict[TaskType, float]]:
"""Pick P(Q | structural_label) weights for a scene.
Conditional table wins if it has a row for the scene's structural label;
else the marginal; else None (→ uniform over eligible families).
"""
raw_weights: Optional[Dict[str, float]] = None
if comp.task_family_weights_by_structure_label and scene_structure_label is not None:
raw_weights = comp.task_family_weights_by_structure_label.get(scene_structure_label)
if not raw_weights and comp.task_family_weights:
raw_weights = comp.task_family_weights
if not raw_weights:
return None
enum_weights: Dict[TaskType, float] = {}
for k, v in raw_weights.items():
try:
enum_weights[parse_task_type(k)] = float(v)
except ValueError:
logger.warning('Unknown task family %r in composition; ignoring', k)
return enum_weights or None
class ExamComposition:
"""Stand-in class for ExamComposition with required attributes."""
def __init__(
self,
task_family_weights: Optional[Dict[str, float]] = None,
task_family_weights_by_structure_label: Optional[Dict[str, Dict[str, float]]] = None,
):
self.task_family_weights = task_family_weights
self.task_family_weights_by_structure_label = task_family_weights_by_structure_label
# Test case 1: Both marginal and conditional weights, conditional takes precedence
comp1 = ExamComposition(
task_family_weights={
'prediction': 0.3,
'association': 0.4,
'effect_estimate': 0.3,
},
task_family_weights_by_structure_label={
'linear': {
'prediction': 0.5,
'causal_sketch': 0.5,
},
'nonlinear': {
'mediation_effect': 0.6,
'counterfactual_effect': 0.4,
},
},
)
ARGS = {
'comp': comp1,
'scene_structure_label': 'linear',
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| _resolve_obs_weights |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("cedc4f415bde2b77") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import numpy as np
from typing import Any, Dict, List, Optional
from enum import Enum
class TaskType(str, Enum):
"""Question family (semantic intent)."""
PREDICTION = 'prediction'
ASSOCIATION = 'association'
COLLIDER_PHENOMENON = 'collider_phenomenon'
CAUSAL_SKETCH = 'causal_sketch'
IDENTIFICATION = 'identification'
EFFECT_ESTIMATE = 'effect_estimate'
BIAS_DIAGNOSTIC = 'bias_diagnostic'
COUNTERFACTUAL_IDENTIFICATION = 'counterfactual_identification'
COUNTERFACTUAL_EFFECT = 'counterfactual_effect'
MEDIATION_EFFECT = 'mediation_effect'
def __str__(self) -> str:
return self.value
class ExamComposition:
"""Stand-in class for ExamComposition."""
def __init__(self, observation_variant_weights_by_family=None, observation_variant_weights=None):
self.observation_variant_weights_by_family = observation_variant_weights_by_family
self.observation_variant_weights = observation_variant_weights
# Create test instances
comp_with_family_weights = ExamComposition(
observation_variant_weights_by_family={
'prediction': {'variant_a': 0.6, 'variant_b': 0.4},
'association': {'variant_x': 0.3, 'variant_y': 0.7},
},
observation_variant_weights={'global_var1': 0.5, 'global_var2': 0.5}
)
comp_with_marginal_weights = ExamComposition(
observation_variant_weights_by_family=None,
observation_variant_weights={'obs_1': 0.25, 'obs_2': 0.75}
)
comp_with_no_weights = ExamComposition(
observation_variant_weights_by_family=None,
observation_variant_weights=None
)
chosen_family_prediction = TaskType.PREDICTION
chosen_family_effect = TaskType.EFFECT_ESTIMATE
ARGS = {
'comp': comp_with_family_weights,
'chosen_family': chosen_family_prediction
}
- 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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| _scene_variant_dir |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("bfc09c3b80e6fe08") How it ranRan 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 PosixPath. 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.
from pathlib import Path
ARGS = {
"scene_dir": Path("/tmp/test_scene"),
"observation_variant": None,
}
- 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 PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath 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
|
| _weighted_choice_from_available |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("3d6d99900a05a2fd") How it ranRan 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 random
from typing import Any, Dict, List, Optional
# Create a random.Random instance for the rng parameter
rng = random.Random(42)
# Create all_weights as a dictionary with various keys and float values
all_weights = {
'option_a': 0.5,
'option_b': 0.3,
'option_c': 0.2,
'option_d': 0.0,
}
# Create available as a list of keys that may or may not be in all_weights
available = ['option_a', 'option_c', 'option_e']
# allow_silent_renorm as a boolean
allow_silent_renorm = True
# no_choice as a fallback value
no_choice = None
ARGS = {
'rng': rng,
'all_weights': all_weights,
'available': available,
'allow_silent_renorm': allow_silent_renorm,
'no_choice': no_choice,
}
- 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 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
|
| list_scene_variants |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("eae3e3a4f970a69c") How it ranRan 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 tempfile
from pathlib import Path
# Create a temporary directory structure to test the function
temp_dir = tempfile.mkdtemp()
scene_dir = Path(temp_dir) / "test_scene"
scene_dir.mkdir(exist_ok=True)
# Create variants directory with some test variants
variants_dir = scene_dir / "variants"
variants_dir.mkdir(exist_ok=True)
# Create variant1 with tasks.json
variant1_dir = variants_dir / "variant1"
variant1_dir.mkdir(exist_ok=True)
(variant1_dir / "tasks.json").touch()
# Create variant2 with data.parquet
variant2_dir = variants_dir / "variant2"
variant2_dir.mkdir(exist_ok=True)
(variant2_dir / "data.parquet").touch()
# Create variant3 without required files (should be skipped)
variant3_dir = variants_dir / "variant3"
variant3_dir.mkdir(exist_ok=True)
# Create a non-directory file in variants (should be skipped)
(variants_dir / "somefile.txt").touch()
ARGS = {
"scene_dir": scene_dir
}
- 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 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
|
| list_scenes |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("fbf133530644d05a") How it ranRan 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 tempfile
from pathlib import Path
# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()
base_dir = Path(temp_dir)
# Create scenes directory
scenes_dir = base_dir / 'scenes'
scenes_dir.mkdir(exist_ok=True)
# Create some test scene directories with story.md files
for scene_id in ['scene_001', 'scene_002', 'scene_003']:
scene_path = scenes_dir / scene_id
scene_path.mkdir(exist_ok=True)
story_file = scene_path / 'story.md'
story_file.write_text(f"# {scene_id}\n\nTest story content")
# Define ARGS
ARGS = {
'base_dir': base_dir
}
- 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 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
|
| load_scene_public |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("234aa5fbbbf6b308") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import tempfile
from pathlib import Path
import json
import pandas as pd
# Create a temporary directory structure to simulate a scene
with tempfile.TemporaryDirectory() as tmpdir:
scene_dir = Path(tmpdir) / "scene_001"
scene_dir.mkdir(parents=True, exist_ok=True)
# Create story.md
story_path = scene_dir / "story.md"
story_path.write_text("This is a test story about a scene.", encoding='utf-8')
# Create variants directory
variants_dir = scene_dir / "variants" / "variant_1"
variants_dir.mkdir(parents=True, exist_ok=True)
# Create schema.json
schema_path = variants_dir / "schema.json"
schema = {
"version": "1.0",
"fields": ["id", "name", "value"]
}
schema_path.write_text(json.dumps(schema), encoding='utf-8')
# Create data.parquet
data_path = variants_dir / "data.parquet"
df_data = pd.DataFrame({
"id": [1, 2, 3],
"name": ["alice", "bob", "charlie"],
"value": [10.5, 20.3, 15.7]
})
df_data.to_parquet(data_path)
# Create calibration.parquet
calibration_path = variants_dir / "calibration.parquet"
df_calib = pd.DataFrame({
"id": [1, 2],
"calibration_value": [0.95, 0.98]
})
df_calib.to_parquet(calibration_path)
# Create tasks.json
tasks_path = variants_dir / "tasks.json"
tasks = {
"task_1": {"description": "Task 1", "difficulty": "easy"},
"task_2": {"description": "Task 2", "difficulty": "hard"}
}
tasks_path.write_text(json.dumps(tasks), encoding='utf-8')
# Define ARGS with the scene_dir and observation_variant
ARGS = {
"scene_dir": str(scene_dir),
"observation_variant": "variant_1"
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- pandas — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| parse_outcome_type |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("263573ac913eebcf") How it ranRan 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 OutcomeType. 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
from enum import Enum
class OutcomeType(str, Enum):
"""Outcome variable type."""
UNKNOWN = 'unknown'
CONTINUOUS = 'continuous'
BINARY = 'binary'
CATEGORICAL = 'categorical'
def __str__(self) -> str:
return self.value
def parse_outcome_type(value):
"""Parse an outcome type into an OutcomeType enum."""
if isinstance(value, OutcomeType):
return value
if value is None:
return OutcomeType.UNKNOWN
if isinstance(value, str):
return OutcomeType(value.strip().lower())
raise ValueError(f'Unrecognized outcome_type: {value!r}')
# Test case 1: OutcomeType enum instance
test_value_1 = OutcomeType.BINARY
# Test case 2: None value
test_value_2 = None
# Test case 3: String value
test_value_3 = "continuous"
# Test case 4: String with whitespace and mixed case
test_value_4 = " CATEGORICAL "
ARGS = {
"value": OutcomeType.CONTINUOUS
}
- 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 OutcomeType — a OutcomeType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OutcomeType 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
|
| parse_rung |
Ran ran, honoured the contract we drafted |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("0986fc61d9da1545") How it ranRan 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 Rung. 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 enum import Enum, IntEnum
class Rung(IntEnum):
"""Pearl hierarchy rung."""
R1 = 1
R2 = 2
R3 = 3
def __str__(self) -> str:
return f'R{int(self)}'
def parse_rung(value):
"""Parse a rung value into a Rung enum."""
if isinstance(value, Rung):
return value
if isinstance(value, int):
return Rung(value)
if isinstance(value, str):
v = value.strip().lower()
if v in {'r1', '1'}:
return Rung.R1
if v in {'r2', '2'}:
return Rung.R2
if v in {'r3', '3'}:
return Rung.R3
raise ValueError(f'Unrecognized rung value: {value!r}')
ARGS = {
'value': 2
}
- 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 Rung — a Rung output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Rung output the recorded ndim 0 and dtype family int 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
|
| parse_task_type |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("c7f4edee0b323065") How it ranRan 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 TaskType. 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
from typing import Any, Dict, List, Optional
from enum import Enum
class TaskType(str, Enum):
"""Question family (semantic intent)."""
PREDICTION = 'prediction'
ASSOCIATION = 'association'
COLLIDER_PHENOMENON = 'collider_phenomenon'
CAUSAL_SKETCH = 'causal_sketch'
IDENTIFICATION = 'identification'
EFFECT_ESTIMATE = 'effect_estimate'
BIAS_DIAGNOSTIC = 'bias_diagnostic'
COUNTERFACTUAL_IDENTIFICATION = 'counterfactual_identification'
COUNTERFACTUAL_EFFECT = 'counterfactual_effect'
MEDIATION_EFFECT = 'mediation_effect'
def __str__(self) -> str:
return self.value
def parse_task_type(value: Any) -> TaskType:
"""Parse a task type into a TaskType enum."""
if isinstance(value, TaskType):
return value
if isinstance(value, str):
v = value.strip().lower()
return TaskType(v)
raise ValueError(f'Unrecognized task_type: {value!r}')
# Test with a string value
ARGS = {
'value': 'prediction'
}
- 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 TaskType — a TaskType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TaskType 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
|
| resolve_structural_label |
Ran ran; our contract draft was wrong, not the code |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("0a80820cffeef210") How it ranRan 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
import numpy as np
from typing import Any, Dict, List, Optional
# Case 1: metadata with structural_label
metadata_with_label = {
'structural_label': 'arch1',
'motif': 'fallback_motif'
}
# Case 2: graph_info with applied_grafts > 0
graph_info_with_grafts = {
'augmentation': {
'applied_grafts': 3
},
'main_graph': {
'motif': 'main_motif'
}
}
# Case 3: graph_info with auxiliary_graph_grafts list
graph_info_with_auxiliary = {
'auxiliary_graph_grafts': ['graft1', 'graft2'],
'main_graph': {
'motif': 'backup_motif'
}
}
# Case 4: metadata with motif
metadata_with_motif = {
'motif': 'scene_motif'
}
# Case 5: graph_info with main_graph.motif
graph_info_with_main = {
'main_graph': {
'motif': 'main_scene_motif'
}
}
# Case 6: empty/None inputs
empty_metadata = {}
empty_graph_info = {}
# Primary test case: metadata with structural_label takes precedence
ARGS = {
'metadata': metadata_with_label,
'graph_info': graph_info_with_grafts
}
- 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 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
|
| Exam |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("0188381c0a0c1981") How it ran |
| ExamItem |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("ae97603a464ef027") How it ran |
| OutcomeType |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("f8896f6aa98efe68") How it ran |
| OutputVariant |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("010c920e7dcd9a49") How it ran |
| Rung |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("51a4180de1afbc91") How it ran |
| TaskInputMode |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("fa486f10ca92e91f") How it ran |
| _apply_rung_tilt |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("321ae7d5014ac05c") How it ran |
| _assign_opaque_answer_file_stems |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("8e248affd3e201fe") How it ran |
| _normalize_composition |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("e795869ed09af8ac") How it ran |
| _resolve_variant_weights |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("26c8d8b2a34e4fbc") How it ran |
| build_exam |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("8b6c01925666d449") How it ran |
| get_output_variant_difficulty_order |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("4c28f9830b3a77fe") How it ran |
| get_task_input_mode |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("cffe0153b32ba4e9") How it ran |
| infer_rung_from_task_type |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("c1f83096d08ad8bb") How it ran |
| normalize_task_fields |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("9112deda4fa73ebe") How it ran |
| parse_output_variant |
Not yet run unverified (harvested, no recorded run) |
andleb/causalds/causalds/exam_builder.py code served (permissive licence) · get_code("e709ab15df436195") How it ran |