feat(qmc): add Halton quasi-Monte Carlo sampler - #250
Open
Samuel-Vangu wants to merge 1 commit into
Open
Conversation
Author
|
@gomezzz, this one's ready for CI too whenever you get a chance — thanks! |
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.
Description
Summary of changes
Halton, a (optionally scrambled) Halton low-discrepancy sampler, shaped exactly likeSobolandRNG— plugs intoMonteCarlo.integratevia the existingrng=slot, no changes toMonteCarloitself.torchbackend: pure PyTorch implementation (digit extraction, hierarchical digit-shift scrambling, integer Horner reconstruction), generated directly on the target device — no CPU/NumPy round-trip needed, unlikeSobolEngine.numpy/jax/tensorflowbackends:scipy.stats.qmc.Halton(already a hard dependency), converted to the requested backend.tests/halton_test.py, mirroringsobol_test.py's structure, plus Halton-specific regression tests (see Test plan).Resolved Issues
How Has This Been Tested?
halton_test.py, all backends: analytic accuracy against the test-function collection, Halton < plain-MC error at equal N (fixed seed), seed reproducibility, torch gradient flowtest_digits_needed_is_per_dimension: deterministic, seed/device-independent unit test guarding against a real bug found during development (a shared digit count across dimensions silently broke equidistribution for every dimension except the one with the smallest base)test_halton_column_independent_of_other_dimensions: exact-equality check that a dimension's column never depends on which other dimensions are requested alongside ittest_halton_matches_scipy_when_unscrambled: pure-PyTorch and SciPy backends agree to within float64 machine epsilon (~2e-16) when scrambling is off, validating the digit extraction/reconstruction independently of the scrambling logictest_halton_no_power_of_two_warning: confirms no spurious warning for non-power-of-two Nruff format --check .clean (57 files)Related Pull Requests