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

unknown scale {self.scale!r}

Error message

unknown scale {self.scale!r}

What it means

Error "unknown scale {self.scale!r}" thrown in rohitg00/ai-engineering-from-scratch.

Source

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

    construct lightweight instances directly so the evaluator can be tested
    in isolation.
    """
    spec_id: str
    terminal: str
    metrics: dict


@dataclass
class MetricSpec:
    name: str
    direction: str = HIGHER
    scale: str = LINEAR

    def validate(self) -> None:
        if self.direction not in (HIGHER, LOWER):
            raise ValueError(f"unknown direction {self.direction!r}")
        if self.scale not in (LINEAR, LOG):
            raise ValueError(f"unknown scale {self.scale!r}")


@dataclass
class Verdict:
    hypothesis_id: int
    metric: str
    direction: str
    scale: str
    candidate_mean: float
    baseline_mean: float
    improvement: float
    p_value: float | None
    significance_threshold: float
    improvement_threshold: float
    verdict: str
    rationale: str

    def to_dict(self) -> dict:

View on GitHub (pinned to 39ea8a1c6d)

When it happens

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