Repository navigation
BUG: let a batch_size=1 convergence study reach a second result - #1233
umutKaracelebi wants to merge 3 commits into
Conversation
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
The skip fixes #1229 through the issue's first option, and the new test fails without it (checked against develop). Inline: one behavior change to fix, plus a docstring and a test note.
simulate_convergence returned an empty history without a word when no batch left two results, so a caller could not tell a converged study from one that was never evaluated. max_simulations below 2 now raises ValueError next to the existing input checks, the Returns section says which batches contribute a width, and a unit test with ConvergenceMockMonteCarlo asserts the estimator is never called with a single observation.
|
All three review points are addressed in 3961883:
|
|
thanks @umutKaracelebi ! Good work! I will review @MateusStano 's review first, and then approve this one later |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1233 +/- ##
===========================================
+ Coverage 86.55% 86.67% +0.11%
===========================================
Files 131 131
Lines 18255 18277 +22
===========================================
+ Hits 15801 15841 +40
+ Misses 2454 2436 -18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
Two more points on the latest version: an early stop at two simulations and a missing boundary test.
`simulate_convergence` accepted the tolerance as soon as the interval width fit, so a `batch_size=1` study could stop after two flights whose values happened to land close together: the first width is computed at two results and is roughly the gap between them (RocketPy-Team#1233). The tolerance is now only accepted once the study holds `MIN_RESULTS_FOR_CONVERGENCE` (30) results. That is below the default `batch_size`, so a default study still stops as soon as its first batch meets the tolerance, while a smaller batch keeps running instead of calling a lucky pair converged. A budget below the floor always runs to completion, which the docstring now says. Adds unit tests for `max_simulations=2`, for the floor itself, and for a batch that meets the floor exactly.
|
Both points from the latest review are addressed in 0eef5f4:
Unit tests (80) and the release integration suite (17) pass locally; |
Fixes #1229
On a fresh study,
simulate_convergence(..., batch_size=1)ran one flight and then raisedValueError: each sample in 'data' must contain two or more observations along 'axis'.. The loop calledestimate_confidence_intervalright after that first batch, andscipy.stats.bootstrapcannot summarise a single observation.simulate_convergencenow skips the interval estimate while the logs hold fewer than two rows and keeps simulating, sobatch_size=1stays usable on a fresh study. Batches that already reach two or more results are untouched, and a study resumed from a one-row log still summarises its first batch, astest_convergence_reads_the_checkpoint_oncerequires.From review: a study that could never estimate an interval no longer returns
[]silently.max_simulations < 2is refused up front next to the other input checks, the Returns section says which batches contribute a width, and a unit test intests/unit/simulation/test_monte_carlo.pydrivesConvergenceMockMonteCarlowithbatch_size=1and asserts the estimator is never called with a single observation.Also:
test_convergence_with_a_batch_size_of_one_waits_for_a_second_resultintests/integration/simulation/test_monte_carlo_release.pyfails without the change with the sameValueErrorand passes with it.pytest tests -q: 2718 passed, 71 skipped.ruff check,ruff format --checkandpylint(10.00/10) are clean on the two edited files.🤖 Authored by an AI agent (Hermes Agent); no human review was involved.