Repository navigation
Conversation
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.
The default 95% interval on a grouped mean calls the bootstrap statistic 1,000 times per group. This patch generates resampling indices for several draws at a time and computes one mean per row. It uses the same random-number stream as the individual draws, with temporary indices and values bounded to about 4 MiB or one complete draw.
The change applies to unstructured means of one real-valued, one-dimensional array. Arbitrary estimators, structured resampling, and named NaN-aware reductions take the existing path. Floating-point inputs with enough range to overflow an intermediate sum also take that path, so an exception leaves the caller’s generator at the same draw. The tests compare the individual estimates, output dtype, and next random bytes to an independent scalar loop for both Generator and RandomState.
Timings
Median elapsed time per complete call on macOS arm64, Python 3.14, NumPy 2.3.5, pandas 2.3.3 and Matplotlib 3.10.8. Each chart created a figure, drew to an Agg canvas and closed the figure. Each revision had 12 warmed calls in four alternating process blocks. Baseline is
c1cb287.All individual bootstrap draws, plot coordinates and rendered RGBA images matched byte for byte. On the 18-group bar plot, the bootstrap calculation alone went from 69.51 ms to 3.61 ms. The estimate for the first group was −0.30619 with interval [−0.61281, −0.00818] in both versions.
Reproduce the fully rendered bar plot benchmark on either checkout
Local checks:
make test(2,376 passed, 14 skipped, six expected failures),make lint, andmake typecheck.