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

Abitrary function outputs in LoopState #229

Closed marpulli closed 5 years ago

marpulli commented 5 years ago

A few loops will require different outputs from the user function and feed them through to the UserFunctionResult then the LoopState. At the minute this requires 3 new classes to be made: a UserFunctionWrapper, a UserFunctionResult and a LoopState. This seems like quite a lot for one-off cases.

This PR allows you to specify the names of the extra function outputs in UserFunctionWrapper and will propagate through to the LoopState automatically. It's currently draft - docstrings, tests, exceptions etc. are not finalised.

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

codecov-io commented 5 years ago

Codecov Report

Merging #229 into master will increase coverage by <.01%. The diff coverage is 95.91%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #229      +/-   ##
==========================================
+ Coverage   89.36%   89.37%   +<.01%     
==========================================
  Files         111      111              
  Lines        3187     3208      +21     
  Branches      337      349      +12     
==========================================
+ Hits         2848     2867      +19     
- Misses        274      275       +1     
- Partials       65       66       +1
Impacted Files Coverage Δ
emukit/core/loop/user_function_result.py 100% <100%> (ø) :arrow_up:
...loops/cost_sensitive_bayesian_optimization_loop.py 82.6% <100%> (ø) :arrow_up:
...it/benchmarking/loop_benchmarking/random_search.py 100% <100%> (ø) :arrow_up:
emukit/core/loop/user_function.py 98.7% <100%> (+0.28%) :arrow_up:
emukit/core/loop/loop_state.py 94.28% <83.33%> (-5.72%) :arrow_down:

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 a068c8d...ac8a8de. Read the comment docs.