rohitg00/ai-engineering-from-scratch · error · ValueError
log scale metric must be positive, got {v}
Error message
log scale metric must be positive, got {v} What it means
Error "log scale metric must be positive, got {v}" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/19-capstone-projects/53-result-evaluator/code/main.py:215
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}")
out.append(math.log(v))
return out
@dataclass
class EvaluatorConfig:
improvement_threshold: float = 0.02
significance_threshold: float = 0.05
class Evaluator:
"""Pure function over (candidate, baseline) result lists; returns a Verdict."""
def __init__(self, config: EvaluatorConfig | None = None) -> None:
self._cfg = config or EvaluatorConfig()
def evaluate(
self,View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/19-capstone-projects/53-result-evaluator/code/main.py:215 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/b5b314f4b68a48e8.
Report an issue: GitHub.