Skip to content

Correct sampler lifecycle and Bayesian posterior evaluation - #1

Merged
jhurliman merged 2 commits into
masterfrom
modernization/sampler-correctness
Sep 10, 2026
Merged

Correct sampler lifecycle and Bayesian posterior evaluation#1
jhurliman merged 2 commits into
masterfrom
modernization/sampler-correctness

Conversation

@jhurliman

@jhurliman jhurliman commented Sep 10, 2026

Copy link
Copy Markdown
Owner

The current sampler shares one RNG across worker threads, chooses the first accepted speculative proposal, and can stop Sample(n) before recording n samples. Replace that path with sequential adaptive Metropolis-within-Gibbs: exactly one proposal per coordinate and one retained state per completed sweep. Remove the obsolete thread-count argument from AMWG::Init. Independent chains are the supported parallelism model.

Fix model support (both sigma bounds and nu >= 1), log-density underflow, precision loss, temporary observation lifetimes, reinitialization, burn/storage coupling and empty/nonfinite statistics. Add deterministic lifecycle checks, analytic density/posterior references and fixed-seed normal/exponential distribution tests. This deliberately changes inferred results and random sequences; migration details are in CHANGELOG.md.

Validation: optimized C++17 regression tests pass locally; ASan/UBSan passes with all 56 checks on Linux and macOS CI. CI runs optimized and sanitized tests on Linux and macOS. Stacked PR #2 adds portable packaging, independent consumers and release preparation. No release has been published.

Addressed the API cleanup requested in #1 (comment): Init accepts only the starting state and log-posterior callback. Removed compatibility cases and updated the benchmark and documentation in the stack.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9dbd8adc08

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread best/best.hpp
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T16:36:27.871551Z 9dbd8ad PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jhurliman
jhurliman added this pull request to stack #3 September 10, 2026 18:33
@jhurliman

Copy link
Copy Markdown
Owner Author

Keep the legacy thread-count argument source-compatible

No need to preserve legacy support here, clean it up.

@jhurliman
jhurliman merged commit 3656483 into master Sep 10, 2026
4 checks passed
@jhurliman
jhurliman deleted the modernization/sampler-correctness branch September 10, 2026 23:26
jhurliman added a commit that referenced this pull request Sep 10, 2026
Stacked on #1. Prepare the first versioned release, 1.0.0, with a
header-only CMake export (`best_cpp::best_cpp`) and public Bzlmod target
(`@bayes//:best_cpp`). Tests, CLI and benchmark builds are opt-in. No
third-party numerical libraries or worker-thread runtime dependencies
are imposed on consumers.

Add installed CMake and renamed-repository Bazel consumers,
independently compiled public headers, and an archive-based temporary
BCR registry consumer with checksum verification. The registry generator
preserves existing configuration; actual BCR submission waits for a
public reviewed release archive. Include model/API documentation,
compatibility notes, reproducibility and convergence limitations,
release instructions, and a workload-specific performance comparison.
Harden CLI parsing, including malformed trailing numeric tokens. Address
the parent review finding by clamping initial sigmas to both prior
bounds, with a highly imbalanced data regression.

Validation: 57 numerical/lifecycle checks; optimized and sanitizer
Linux/macOS CI passed in #1. Local CMake
library/tests/CLI/benchmark/install and independent consumer passed;
Bazel 9.2 regression, renamed consumer and registry archive consumer
passed. This PR adds Linux/macOS/Windows CMake CI plus Bazel CI. No tag
or package has been published.


Addressed the API cleanup requested in
#1 (comment):
Init accepts only the starting state and log-posterior callback. Removed
compatibility cases and updated the benchmark and documentation in the
stack.
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