utils.vegas_integrals module

class VegasSampler(*args, **kwargs)[source]

Bases: utils.integral_validation.Sampler

Parameters
  • integrator

  • train

  • n_survey_steps

  • n_batch

sample(f, n_batch=10000, *args, **kwargs)[source]
Parameters
  • f (utils.integrands.Integrand) –

  • n_batch (int) –

Returns

  • tuple of torch.Tensor

  • x,px,fx (points, pdfs, function values)

sample_non_stratified(f, n_batch=10000, *args, **kwargs)[source]
Parameters
  • f (batch callable) – function mapping numpy arrays to numpy arrays

  • n_batch

  • args

  • kwargs

sample_stratified(f, n_batch)[source]
train_integrator(n_survey_steps, n_batch)[source]

Train the integrator before sampling

Parameters
  • n_survey_steps (int) – if train is True, how many survey steps to use for training

  • n_batch (int) – maximum number of function evaluations per survey step

evaluate_integral_vegas(f, integrator, n_batch=10000, train=True, n_survey_steps=10, n_batch_survey=10000, stratified=False)[source]

Validate a known integral using a VEGAS integrator as a sampler

Parameters
  • f (utils.integrands.KnownIntegrand) –

  • integrator (zunis.integration.adaptive_survey_integrator.AdaptiveSurveyIntegrator) –

  • n_batch (int) –

  • train (bool) – whether to train the integrator using integrator.survey

  • n_survey_steps (int or None) – positional integrator.survey argument

  • n_batch_survey (int or None) –

  • stratified (bool) – whether to use VEGAS stratified sampling

Returns

Return type

utils.record.EvaluationRecord