Fix GBM demo replication statistics and speed up the Gaussian transform - #585
Fix GBM demo replication statistics and speed up the Gaussian transform#585larissensium wants to merge 339 commits into
Conversation
…tware/QMCSoftware into geometric_brownian_motion
README.md: * Corrected filename references. * Removed references to non-existent files. averaged_mae.py: * Fixed PEP 8 spacing for parameter qp_seed and use the parameter in code. *Enhanced documentation with. *Removed an unused import. * Cleaned up code by removing a commented-out block.
…tware/QMCSoftware into geometric_brownian_motion
|
@sou-cheng-choi added some explanation and formulas to the demo |
|
The symbol |
|
For API consistency, when
Prefer |
alegresor
left a comment
There was a problem hiding this comment.
Defer to @sou-cheng-choi review on this
I fixed
As far as I know Quantlib's Sobol implementation does not support randomization so changing the seed does not randomize the sequence. So we get the same paths despite changing the seed |
|
Please request for re-review from me and @alegresor when you feel ready. |
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
JiangruiKang
left a comment
There was a problem hiding this comment.
The switch to Burley scrambling is the right way to obtain independent randomized-QMC replications, but one reproducibility defect remains at dimensions above the Jaeckel table. The current tests are green because they use n_steps=4; please cover the 32/33-dimensional boundary before merging.
| # Jaeckel direction integers, so changing its `seed` does not create an | ||
| # independent replication. Burley2020SobolRsg applies a seeded Owen-style | ||
| # scramble; keep the underlying Sobol seed fixed and vary the scramble. | ||
| uniform_rsg = ql.Burley2020SobolRsg(dimension, 0, ql.SobolRsg.Jaeckel, seed) |
There was a problem hiding this comment.
[P2] Use a fixed nonzero underlying Sobol seed
QuantLib treats this second argument differently from the replication-specific scramble seed. Jaeckel direction integers are tabulated only through dimension 32; above that, SobolRsg uses this value to generate additional direction integers, and QuantLib defines 0 as a clock-selected random seed. Consequently, two calls with the same public seed can produce different paths when n_steps >= 33 (see lballabio/QuantLib#2732), even though the comment says the underlying seed is fixed. Please use a fixed nonzero value such as 42, vary only scrambleSeed, and add a regression test at n_steps=33 showing that equal scramble seeds reproduce exactly while different scramble seeds remain distinct.
Fixed a table in gbm_demo to correctly show results averaged over replications.