feat(regen): add --n-evals + median+CI reporting to distinguish signal from noise#286
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances scripts/regenerate_convergence_results.py to optionally repeat post-hoc ObjectiveFunction evaluations (--n-evals N) and report median-based scores plus uncertainty metrics, so convergence artifacts can better separate real optimization signal from per-call engine noise.
Changes:
- Add
--n-evalsCLI option (default1) and record it in provenance. - Re-evaluate ObjectiveFunction at initial/final parameters
Ntimes and emit median/CI fields + a significance flag intovalidation_results.json. - Update the “optimized” log line to include median improvement and CI when
N > 1.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
853c61a to
edee1ad
Compare
…from noise Add post-hoc repeated ObjectiveFunction evaluation for convergence regeneration so q2mm#284 §2 noise findings from q2mm#283 can be reported as measurement uncertainty instead of single-call verdicts. The validation JSON keeps the legacy initial_obj_score, final_obj_score, and improvement_pct fields for existing consumers, and adds: - initial_obj_score_mean, initial_obj_score_ci95 - final_obj_score_mean, final_obj_score_ci95 - improvement_pct_mean, improvement_significant Reports the sample mean (not median) paired with a Student-t 95% CI half-width — the t-distribution describes the sampling distribution of the mean, not the median. For n ≤ 10 with the bounded engine noise we measure here, sample mean and median are nearly identical; the mean is the right center to pair with a t-CI. ObjectiveFunction.history is restored between samples by truncating back to its original length (O(1)) rather than copying-then-replacing (O(len)) — important when the optimizer has accumulated many evaluations. Validation: - ruff check + format clean - 680 unit tests pass (24 new tests from #285 included) - ch3f smoke run with --n-evals 3 produces both legacy and new fields; ci95 ≈ 1e-15 (deterministic single-mol system); SIGNIFICANT verdict as expected (99.83 % vs ~0 CI) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds post-hoc median-of-N ObjectiveFunction reporting to
scripts/regenerate_convergence_results.pyso convergence artifacts can distinguish real force-field optimization signal from the per-call engine noise documented in q2mm#284 §2 after the q2mm#283 runs.What changes
--n-evals Nwith default1for backwards-compatible single-call behavior.validation_results.json.N > 1.Backwards compatibility
Existing consumers can keep reading these unchanged fields:
initial_obj_scorefinal_obj_scoreimprovement_pctThe new fields are additive:
initial_obj_score_median,initial_obj_score_ci95,final_obj_score_median,final_obj_score_ci95,improvement_pct_median, andimprovement_significant.Validation
/home/eric/repos/q2mm/.venv/bin/python -m ruff check scripts/ q2mm//home/eric/repos/q2mm/.venv/bin/python -m ruff format --check scripts/ q2mm/PYTHONPATH=/home/eric/repos/q2mm-feat-regen-median-of-n /home/eric/repos/q2mm/.venv/bin/python -m pytest test/ -x -q -m "not (openmm or tinker or jax or jax_md or psi4)"Q2MM_SUPPORTING_INFO=/home/eric/repos/q2mm/validation/supporting-info PYTHONPATH=/home/eric/repos/q2mm-feat-regen-median-of-n /home/eric/repos/q2mm/.venv/bin/python scripts/regenerate_convergence_results.py --system ch3f --output-dir results/regen-n1Q2MM_SUPPORTING_INFO=/home/eric/repos/q2mm/validation/supporting-info PYTHONPATH=/home/eric/repos/q2mm-feat-regen-median-of-n /home/eric/repos/q2mm/.venv/bin/python scripts/regenerate_convergence_results.py --system ch3f --n-evals 3 --output-dir results/regen-n3Next step (separate PR)
Phase D will re-run the three metal-TS systems with
--n-evals 5and update the docs with significant / no-improvement / inconclusive verdicts.