rohitg00/ai-engineering-from-scratch · error · ValueError
max_experiments must be >= 1
Error message
max_experiments must be >= 1
What it means
Error "max_experiments must be >= 1" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/19-capstone-projects/56-iteration-scheduler/code/main.py:132
class IterationScheduler:
"""Drives a hypothesis queue across N parallel asyncio slots with UCB picking."""
def __init__(
self,
runner: Runner,
slots: int = 3,
max_experiments: int = 50,
max_seconds: float = 30.0,
exploration_c: float = math.sqrt(2.0),
paper_threshold: float = 0.7,
prune_floor: float = 0.2,
prune_after_runs: int = 3,
expander: Expander | None = None,
) -> None:
if slots < 1:
raise ValueError("slots must be >= 1")
if max_experiments < 1:
raise ValueError("max_experiments must be >= 1")
self.runner = runner
self.slots = slots
self.max_experiments = max_experiments
self.max_seconds = max_seconds
self.exploration_c = exploration_c
self.paper_threshold = paper_threshold
self.prune_floor = prune_floor
self.prune_after_runs = prune_after_runs
self.expander = expander
def _pick_next(self, queue: list[Hypothesis], stats: dict[str, BranchStats]) -> int | None:
best_idx: int | None = None
best_score = -float("inf")
total_runs = sum(s.runs for s in stats.values())
for idx, hyp in enumerate(queue):
bs = stats.get(hyp.branch)
if bs is not None and bs.pruned:
continueView on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/19-capstone-projects/56-iteration-scheduler/code/main.py:132 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26).
Data as JSON: /api/errors/73733cd26b2bd117.
Report an issue: GitHub.