Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VEGAS_Stratify Counts, JF and JF2 accumulation #1

Open
FHof opened this issue Jan 26, 2022 · 1 comment
Open

VEGAS_Stratify Counts, JF and JF2 accumulation #1

FHof opened this issue Jan 26, 2022 · 1 comment

Comments

@FHof
Copy link

FHof commented Jan 26, 2022

When I compared VEGAS+ implementations, I noticed that the Counts, JF and JF2 are reset to zero after each iteration in the VegasFlow and original gplepage implementations, while in the code in this repository they are accumulated and set to zero only once in the initialisation.
I opened this issue because I doubt that this behaviour is intentional. Calculating an approximate variance from values of all previous iterations could work badly because a VEGAS_Map update changes which parts of the integration domain the hybercubes cover.

Additional Information

Relevant code in VegasFlow: https://github.com/N3PDF/vegasflow/blob/21209c928d07c00ae4f789d03b83e518621f174a/src/vegasflow/vflowplus.py#L202
In VegasFlow the variance is directly calculated with vectorized Tensorflow operations

Relevant code in gplepage vegas: https://github.com/gplepage/vegas/blob/11f67af45c8fc5c8c25060f18a61137274a64789/src/vegas/_vegas.pyx#L1645
In gplepage vegas the variance is a covariance matrix because it supports integrands which output a vector for each sample point.

torchquad's VEGAS+ implementation is based on code from this repository. There a code rewrite happened after which only Counts but not JF and JF2 were accumulated: esa/torchquad@154aa72#diff-043ebca7e1b0e1177dca8d0ce7bca0efc00f0a68c90edeea6b272ff39505e0e2L41

I'm not sure if my descriptions about what happens in these four implementations is correct or if I made a mistake. I did not execute all the code to test my assumptions.

@ycwu1030
Copy link
Owner

Hey:
Thanks for pointing this out. It should be better to reset JF JF2 and counts every iteration. I shall modify the behavior in later version. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants