{"record":{"id":"9cd3226ee6a151e0","repo":"rohitg00/ai-engineering-from-scratch","slug":"no-positive-weights-match-the-eval-names","errorCode":null,"errorMessage":"no positive weights match the eval names","messagePattern":"no positive weights match the eval names","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/41-eval-pipeline/code/main.py","lineNumber":662,"sourceCode":"    aggregate: float\n    details: Dict[str, EvalResult] = field(default_factory=dict)\n\n    def to_dict(self) -> Dict[str, Any]:\n        return {\n            \"per_eval\": self.per_eval,\n            \"normalised\": self.normalised,\n            \"weights\": self.weights,\n            \"aggregate\": self.aggregate,\n            \"details\": {k: v.to_dict() for k, v in self.details.items()},\n        }\n\n\ndef aggregate(results: Sequence[EvalResult], weights: Optional[Dict[str, float]] = None) -> FinalReport:\n    weights = dict(weights or DEFAULT_WEIGHTS)\n    # Normalise weights so they sum to 1.\n    total_w = sum(weights.get(r.name, 0.0) for r in results)\n    if total_w <= 0:\n        raise ValueError(\"no positive weights match the eval names\")\n    norm_weights = {r.name: weights.get(r.name, 0.0) / total_w for r in results}\n    per_eval = {r.name: r.metric for r in results}\n    normalised = {r.name: normalise_metric(r.name, r.metric) for r in results}\n    agg = sum(normalised[name] * norm_weights[name] for name in normalised)\n    return FinalReport(\n        per_eval=per_eval,\n        normalised=normalised,\n        weights=norm_weights,\n        aggregate=agg,\n        details={r.name: r for r in results},\n    )\n\n\n# ---------------------------------------------------------------------------\n# Pretty printer\n# ---------------------------------------------------------------------------\n\n","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/41-eval-pipeline/code/main.py#L644-L680","documentation":"Error \"no positive weights match the eval names\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/41-eval-pipeline/code/main.py:662 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}