EmuKit / emukit

A Python-based toolbox of various methods in decision making, uncertainty quantification and statistical emulation: multi-fidelity, experimental design, Bayesian optimisation, Bayesian quadrature, etc.
https://emukit.github.io/emukit/
Apache License 2.0
605 stars 128 forks source link

Unify handling of integration measures in `quadrature` #423

Closed mmahsereci closed 2 years ago

mmahsereci commented 2 years ago

Issue #, if available:

Description of changes: So far the handling of integration measures was not homogeneous throughout the quadrature package. For example the un-normalized Lebesgue measure was represented as measure=None but required integral bounds, while the normalized Lebesgue measure required the instance of IntegrationMeasure class and no bounds. While confusing, this also led to many if-else statements in the code.

With this PR, integration measures are now handled homogeneously in the Emukit code. Integration bounds are hence only used as convenience interfaces for users where needed.

The nice thing that came for free with his PR is that normalized Lebesgue measures are now available for all kernel embeddings as well (previously only the un-normalized ones were).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov-commenter commented 2 years ago

Codecov Report

Merging #423 (3c3f58e) into main (82b58f9) will increase coverage by 0.00%. The diff coverage is 90.32%.

@@           Coverage Diff           @@
##             main     #423   +/-   ##
=======================================
  Coverage   89.04%   89.04%           
=======================================
  Files         136      136           
  Lines        4746     4703   -43     
  Branches      697      681   -16     
=======================================
- Hits         4226     4188   -38     
+ Misses        400      398    -2     
+ Partials      120      117    -3     
Impacted Files Coverage Δ
.../point_calculators/quadrature_point_calculators.py 34.61% <0.00%> (ø)
emukit/model_wrappers/gpy_quadrature_wrappers.py 82.26% <72.41%> (+1.34%) :arrow_up:
emukit/quadrature/kernels/quadrature_kernels.py 82.89% <77.27%> (-5.68%) :arrow_down:
emukit/quadrature/measures/integration_measure.py 72.72% <81.81%> (+2.13%) :arrow_up:
emukit/quadrature/measures/lebesgue_measure.py 91.30% <91.30%> (ø)
...it/quadrature/acquisitions/uncertainty_sampling.py 86.20% <100.00%> (-1.68%) :arrow_down:
emukit/quadrature/kernels/__init__.py 100.00% <100.00%> (ø)
emukit/quadrature/kernels/quadrature_brownian.py 96.96% <100.00%> (+1.51%) :arrow_up:
emukit/quadrature/kernels/quadrature_matern32.py 98.00% <100.00%> (+0.04%) :arrow_up:
emukit/quadrature/kernels/quadrature_matern52.py 98.03% <100.00%> (+0.08%) :arrow_up:
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 82b58f9...3c3f58e. Read the comment docs.