utils.benchmark.known_integrand_benchmarks module¶
- class KnownIntegrandBenchmarker[source]¶
Bases:
utils.benchmark.benchmarker.Benchmarker
Benchmark by comparing to a known integrand with an exact integral value
- benchmark_method(d, integrand, integrator_config=None, integrand_params=None, n_batch=100000, keep_history=False, device=device(type='cpu'))[source]¶
Integrate an known integrand and compare with the theoretical result
- Parameters
d (int) – number of dimensions
integrand (constructor for utils.integrands.abstract.KnownIntegrand) – integrand class to be tested. Expects a constuctor for that class, i.e. a callable that returns an instance.
integrator_config (dictwrapper.NestedMapping, None) – configuration to be passed to
Integrator
. IfNone
, use thedefault
.n_batch (int) – batch size used for the benchmarking (after training)
integrand_params (dict) – dictionary of parameters provided to
integrand
throughintegrand(**integrand_params)
.device (torch.device) – torch device on which to train and run the
Integrator
.
- class KnownIntegrandGridBenchmarker(n_repeat=1)[source]¶
Bases:
utils.benchmark.benchmarker.GridBenchmarker
,utils.benchmark.known_integrand_benchmarks.KnownIntegrandBenchmarker
Benchmark against a known integrand by sampling configurations from a grid
- Parameters
n (int) – Optional: How often the grid is sampled.
- class KnownIntegrandRandomHPBenchmarker(n_samples=5, n_repeat=1)[source]¶
Bases:
utils.benchmark.benchmarker.RandomHyperparameterBenchmarker
,utils.benchmark.known_integrand_benchmarks.KnownIntegrandBenchmarker
Benchmark against a known integrand by sampling integrator hyperparameters randomly
- Parameters
n_samples (int) – Number of random integrator configurations to draw
n_repeat (int) – Optional: How often the grid is sampled.