{"record":{"id":"a31d6f3a8215ab12","repo":"rohitg00/ai-engineering-from-scratch","slug":"x-out-of-0-1","errorCode":null,"errorMessage":"x out of [0, 1]","messagePattern":"x out of \\[0, 1\\]","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/53-result-evaluator/code/main.py","lineNumber":129,"sourceCode":"        aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2))\n        d = 1.0 + aa * d\n        if abs(d) < eps:\n            d = eps\n        c = 1.0 + aa / c\n        if abs(c) < eps:\n            c = eps\n        d = 1.0 / d\n        delta = d * c\n        h *= delta\n        if abs(delta - 1.0) < eps:\n            return h\n    return h\n\n\ndef regularised_incomplete_beta(a: float, b: float, x: float) -> float:\n    \"\"\"I_x(a, b) via the standard Lentz continued fraction, symmetric in x.\"\"\"\n    if x < 0.0 or x > 1.0:\n        raise ValueError(\"x out of [0, 1]\")\n    if x == 0.0:\n        return 0.0\n    if x == 1.0:\n        return 1.0\n    log_bt = (\n        math.lgamma(a + b) - math.lgamma(a) - math.lgamma(b)\n        + a * math.log(x) + b * math.log(1.0 - x)\n    )\n    bt = math.exp(log_bt)\n    if x < (a + 1.0) / (a + b + 2.0):\n        return bt * _lentz_betacf(a, b, x) / a\n    return 1.0 - bt * _lentz_betacf(b, a, 1.0 - x) / b\n\n\ndef two_sided_t_p_value(t_stat: float, df: int) -> float:\n    \"\"\"Two sided p value for a t statistic with df degrees of freedom.\"\"\"\n    if df <= 0:\n        return 1.0","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/53-result-evaluator/code/main.py#L111-L147","documentation":"Error \"x out of [0, 1]\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/53-result-evaluator/code/main.py:129 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"}