Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-train/blob/main/eval/omegese45/oe_wilson.py # aien-train AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-train / eval / omegese45 / oe_wilson.py` 21 lines ยท 777 bytes Raw Blame History 1 """Two-sided Wilson 95% interval; verified against Wolfram in the eval receipt. 2 3 The interval is descriptive for the declared units, not a claim that points 4 within an episode are independent. A zero denominator is NOT_DEFINED, not 0. 5 """ 6 from math import sqrt 7 from statistics import NormalDist 8 9 10 def wilson(k, n): 11 if not (isinstance(k, int) and isinstance(n, int) and 0 <= k <= n): 12 raise ValueError("Wilson requires integer 0 <= k <= n") 13 if n == 0: 14 return None 15 z = NormalDist().inv_cdf(0.975) 16 p = k / n 17 d = 1 + z * z / n 18 center = (p + z * z / (2 * n)) / d 19 radius = z * sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d 20 return [0.0 if k == 0 else max(0.0, center - radius), 21 1.0 if k == n else min(1.0, center + radius)]