Skip to content

fix(rhat): subnormal floor, discriminating tolerance probes, corrected docstring (#39 follow-up) - #45

Merged
marcohost33-maker merged 2 commits into
mainfrom
fix/rhat-folded-docs-and-probes
Sep 26, 2026
Merged

marcohost33-maker merged 2 commits into
mainfrom
fix/rhat-folded-docs-and-probes

Conversation

@marcohost33-maker

Copy link
Copy Markdown
Owner

Follow-up to #39 from its second delta review (P3 items; two of them are corrections of my own docstrings/tests).

Changes

  • Upper-tolerance probe was too weak. It used a difference of 1e-13 at scale 1 and called it "~30 eps"; it is ~450 eps (28× the 16-eps tolerance), so a 16× looser tolerance survived. Now 1e-14 (~45 eps). Measured on 8db2b7d: tolerance ×4 → the probe goes red, ×2 → stays green; the tolerance is pinned to a factor 2–4.
  • Non-discriminating location case replaced: (-1000.25, -999.5) was already caught by the old (location-blind) rule; (-1000.3, -1000.1) is not.
  • Subnormal hole closed: a balanced chain (1e-315, 2e-315+5e-324) still reported OK/converged because eps*scale underflows to 0 while folding rounds by one ulp. The tolerance is now max(16·eps·scale, 16·spacing(scale)) — unchanged for normal numbers.
  • Docstring rhat_defined wrongly said that under DEGENERATE_FOLDED rhat is the bulk R-hat; the reviewer measured rhat = 1.0 in 234/400 cases. Now: max(bulk, folded) with a non-meaningful folded component.

Evidence (Windows, py3.12) at d46e768

  • new subnormal test red on 8db2b7d, green after the fix
  • tests/test_rhat.py tests/test_manifest.py tests/test_checkpoint.py: 49 passed, exit 0; ruff check + ruff format --check clean
  • diskriminierung.py run DK-20260926T095204-ad146ec2860f (provenance VOLL): 4/4 — spacing floor, tolerance ×4, location term (new case), positive control
  • full suite and selftest: CI

🤖 Generated with Claude Code

marcohost33-maker and others added 2 commits September 26, 2026 11:52
- upper-tolerance probe: 1e-14 (~45 eps) instead of 1e-13 (~450 eps, which
  let a 16x looser tolerance pass); measured: 4x looser -> red, 2x -> green
- (-1000.3, -1000.1) replaces (-1000.25, -999.5), which the old rule already caught
- subnormal balanced chain (1e-315, 2e-315+5e-324) must be DEGENERATE_FOLDED

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hat_defined docstring

Below the normal range eps*scale underflows to 0 while folding rounds by one
ulp; the tolerance is now max(16 eps * scale, 16 * spacing(scale)), which is
unchanged for normal numbers. The rhat_defined docstring wrongly said rhat is
the bulk R-hat under DEGENERATE_FOLDED (reviewer: rhat = 1.0 in 234/400).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@marcohost33-maker

Copy link
Copy Markdown
Owner Author

Independent round (Equalita role, same family) at d46e768: PASS (P3 only). (a) For normal s, spacing(s) ≤ eps·s, so the new floor never binds there — probed over 206 138 values, the only exception is s = DBL_MAX (np.spacing overflows, verdict flips OK → DEGENERATE_FOLDED, i.e. fail-closed); verdict comparison old vs new over 1000 cases (60/40, 2001/1999, iid, 1e6+N(0,1), shifted two-point) — 0 differences. (b) The upper-tolerance probe is exactly 45 eps: tolerance ×2 and ×2.8 green, ×2.9/×3/×4 red, identical over 50 seeds (median is global) — pinned to factor ~2.8. (c) Old rule: (-1000.25,-999.5) has ptp 0 (already caught), (-1000.3,-1000.1) ptp 512 eps (missed) — the replacement discriminates. Reviewer's runs: 49 passed, selftest 45/45, exit 0; discrimination DK-20260926T103544-a8db82703e88 5/5 (VOLL). P3: 'unchanged for normal numbers' does not hold at DBL_MAX; '234/400' not reproduced by the reviewer (165/400 with their distribution; qualitative 'often 1.0' holds). Tracked in #46's follow-up.

🤖 Generated with Claude Code

@marcohost33-maker
marcohost33-maker merged commit c7b011a into main Sep 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant