esa / esa/torchquad

Suggestions for VEGAS algorithm changes

Open
#143 0 comments 0 reactions 0 assignees View on GitHub
enhancement optimization
Dominant language
Python
Stars
230
Forks
47
Avg merge
1d 11h
Merged PRs (30d)
8

Description

# Feature
## Desired Behavior / Functionality

It could be possible to change torchquad's VEGAS algorithm so that it converges a bit faster with common integrands.
* A method could be added to to VEGASMap which splits each interval in the middle. When executed this would double the number of intervals while the mapping stays the same (until the next map update). With this it could be possible to warm up the VEGASMap first with a small number of intervals and points per iteration, then split the intervals and continue the warm-up with more points.
* Currently every fifth iteration VEGAS may abort, or reset the collected results and increase the number of samples per iteration.
This behaviour [is from](https://github.com/ycwu1030/CIGAR/blob/801bb6a0edf9015363be93e0e5b7d003efeccc17/src/VEGAS_Integrator.cpp#L265) the VEGAS implementation on which torchquad's VEGAS is based on. The `chi2 / 5.0 < 1.0` condition may be incorrect since according to the G. P. Lepage paper and [tutorial](https://vegas.readthedocs.io/en/latest/tutorial.html), chi2 should be in the order of the number of iterations minus one, which corresponds to `chi2 / 4.0 < 1.0`.
* If the VEGAS quadrature is executed sequentially many times with an integrand whose parameters change only slightly over time, it may sometimes be beneficial to re-use a previous VEGASMap and VEGASStratification. This situation may occur when VEGAS is used in a function which is optimised with stochastic gradient descent.

## What Needs to Be Done

* Implement the VEGASMap interval splitting in vegas_map.py and use it for the warm-up in vegas.py
* Investigate if the condition on chi2 in vegas.py works well or should be changed
* Change VEGAS so that it is possible to continue the integration with a new integrand but the same VEGASMap and VEGASStratification

Contributor guide

Open the contributing guide

Research direction

Start with vegas_map.py and vegas.py, reading the existing VEGASMap warm-up, chi2 check, and VEGASStratification handling. Implement and assess interval splitting, investigate the chi2 condition, and support continuing with a new integrand while reusing the map and stratification.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.