rohitg00/ai-engineering-from-scratch · error · PairingError

no shared seeds between candidate and baseline

Error message

no shared seeds between candidate and baseline

What it means

Error "no shared seeds between candidate and baseline" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/19-capstone-projects/53-result-evaluator/code/main.py:197

        seed = r.metrics.get("seed")
        if seed is None:
            raise PairingError(f"candidate {r.spec_id} missing seed")
        seed_i = int(seed)
        if seed_i in cand_map:
            raise PairingError(f"duplicate candidate seed {seed_i} (spec {r.spec_id})")
        cand_map[seed_i] = float(r.metrics[metric])
    base_map: dict[int, float] = {}
    for r in baselines:
        seed = r.metrics.get("seed")
        if seed is None:
            raise PairingError(f"baseline {r.spec_id} missing seed")
        seed_i = int(seed)
        if seed_i in base_map:
            raise PairingError(f"duplicate baseline seed {seed_i} (spec {r.spec_id})")
        base_map[seed_i] = float(r.metrics[metric])
    shared = sorted(set(cand_map.keys()) & set(base_map.keys()))
    if not shared:
        raise PairingError("no shared seeds between candidate and baseline")
    return [cand_map[s] for s in shared], [base_map[s] for s in shared]


def _improvement(candidate_mean: float, baseline_mean: float, direction: str) -> float:
    denom = abs(baseline_mean) if baseline_mean != 0.0 else 1.0
    raw = (candidate_mean - baseline_mean) / denom
    if direction == LOWER:
        return -raw
    return raw


def _log_transform(values: list[float], scale: str) -> list[float]:
    if scale != LOG:
        return list(values)
    out = []
    for v in values:
        if v <= 0.0:
            raise ValueError(f"log scale metric must be positive, got {v}")

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/19-capstone-projects/53-result-evaluator/code/main.py:197 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/2806d937a9b606d7. Report an issue: GitHub.