Add sobol sampler as well as tests and demonstrating notebook - #325
Open
Samuel-Vangu wants to merge 2 commits into
Open
Add sobol sampler as well as tests and demonstrating notebook#325Samuel-Vangu wants to merge 2 commits into
Samuel-Vangu wants to merge 2 commits into
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.
Adds a
Sobolsampling class for integration on (hyper)cubic grids,following up on the discussion in #322.
What's included
src/grid/sobol.py:Sobol(n_points, dimension, seed=None, randomize=True, origin=None, axes=None). Wrapsscipy.stats.qmc.Sobol(already agriddependency), generating points via
random_base2for the balanceproperties of the digital-net construction;
n_pointsmust therefore be apower of 2.
randomize=Falsegives the deterministic, unscrambledsequence (whose first point is always the origin);
randomize=Trueapplies Owen scrambling. Supports mapping onto an arbitrary parallelepiped
via
origin/axes.src/grid/tests/test_sobol.py: tests covering validation, weights, domainmapping, integration accuracy, reproducibility, and properties specific to
Sobol' sequences (origin as first point when unrandomized, the nesting
property between an N-point and a 2N-point design).
examples/: comparesSobolagainst baselinesalready in
grid(plain Monte Carlo,Tensor1DGrids/Trapezoidal) on twochemistry-motivated integrands -- a product of Gaussian-type functions
(smooth) and a spherical interaction-cutoff indicator (discontinuous) --
to show honestly where Sobol's low-discrepancy advantage holds and where
it doesn't.