Skip to content

Validate shared log weight normalization - #232

Open
fujikix1102 wants to merge 1 commit into
cosmosis-developers:mainfrom
fujikix1102:audit/log-weight-contracts
Open

fujikix1102 wants to merge 1 commit into
cosmosis-developers:mainfrom
fujikix1102:audit/log-weight-contracts

Conversation

@fujikix1102

Copy link
Copy Markdown

Summary

  • centralize max-scaled log-weight conversion with explicit finite and positive-sum checks
  • use the contract in sampler chain starts, hints, GetDist export, and postprocessing weights
  • preserve zero-weight samples while rejecting NaN, positive infinity, empty, and all-zero inputs

Validation

  • PYTHONPATH=$PWD pytest -q cosmosis/test/test_utils.py cosmosis/test/test_samplers.py -k 'normalized_log_weights or maxlike' --disable-warnings --maxfail=1
  • 19 passed, 33 deselected
  • PYTHONPATH=$PWD pytest -q cosmosis/test/test_getdist.py --disable-warnings --maxfail=1
  • 3 passed

@fujikix1102

Copy link
Copy Markdown
Author

Review coordination requested before merge.

The log-weight contract itself is clear: preserve zero-weight samples, reject NaN/positive-infinity/empty/all-zero inputs, and reuse one max-scaled normalization across sampler starts, hints, GetDist export, and postprocessing. The focused validations report 19 passed plus 3 GetDist tests passed.

This branch also contains commit fddc6b8 from #231 (Validate SPD matrices before stable inversion). Please confirm whether #232 is intentionally stacked on #231 and should be reviewed/merged only after #231, or whether the SPD commit should be removed from this branch to keep the PR independently reviewable.

@joezuntz

joezuntz commented Nov 6, 2026

Copy link
Copy Markdown
Member

Please remove the parts from 231

@fujikix1102
fujikix1102 force-pushed the audit/log-weight-contracts branch from 5290344 to cc2a6b8 Compare November 6, 2026 22:15
@fujikix1102

Copy link
Copy Markdown
Author

Removed the parts inherited from #231 so this PR now contains only the shared log-weight normalization changes. The branch was rewritten from 5290344 to cc2a6b8.

Validation after the cleanup:

  • Focused utility and sampler tests: 19 passed
  • GetDist tests: 3 passed

The SPD inversion changes and their tests are no longer part of #232.

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.

2 participants