Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cost bo loop #195

Merged
merged 7 commits into from May 17, 2019
Merged

Cost bo loop #195

merged 7 commits into from May 17, 2019

Conversation

aaronkl
Copy link
Contributor

@aaronkl aaronkl commented May 14, 2019

Currently, we can only pass initial data points and their corresponding function values to the BO optimization loop. However, in case we also want to keep track of the cost per function evaluation, we should also be able to pass the initial cost. Otherwise, this will mess up our internal loop state.

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

@codecov-io
Copy link

codecov-io commented May 14, 2019

Codecov Report

Merging #195 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #195   +/-   ##
=======================================
  Coverage   89.47%   89.47%           
=======================================
  Files         105      105           
  Lines        2861     2861           
  Branches      292      292           
=======================================
  Hits         2560     2560           
  Misses        249      249           
  Partials       52       52
Impacted Files Coverage Δ
emukit/core/loop/loop_state.py 100% <ø> (ø) ⬆️

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 0b88bca...d9c016c. Read the comment docs.

Copy link
Collaborator

@apaleyes apaleyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one naming thing, otherwise good to go

@@ -59,6 +59,7 @@ def create_loop_state(x_init: np.ndarray, y_init: np.ndarray, cost: np.ndarray =

:param x_init: x values for initial function evaluations.
:param y_init: y values for initial function evaluations
:param cost: observed costs for initial function evaluations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@@ -14,13 +14,15 @@

def create_bayesian_optimization_loop(x_init: np.ndarray, y_init: np.ndarray, parameter_space: ParameterSpace,
acquisition_type: AcquisitionType, model_type: ModelType,
c_init: np.ndarray = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be more expressive

Suggested change
c_init: np.ndarray = None,
cost_init: np.ndarray = None,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

@apaleyes
Copy link
Collaborator

Actually one more thing. Can you add a unit test that verifies initial cost is used as expected? Can be as simple as "create bo loop, make sure cost is in the state, done"

@aaronkl
Copy link
Contributor Author

aaronkl commented May 14, 2019

ok I've updated a simple unit test that check whether the all the initial data is in the loop state

@apaleyes
Copy link
Collaborator

Looks good, but the build fails for some reason

@aaronkl
Copy link
Contributor Author

aaronkl commented May 14, 2019

hmm wired, I dont understand why it suddenly throws an import error?

@aaronkl
Copy link
Contributor Author

aaronkl commented May 15, 2019

Ok after some digging, the problem seems to be a bug in pytorch here
It seems that they are already working on a PR. In the meantime: brew install libomp seems to solve the problem

@apaleyes
Copy link
Collaborator

Ok, few options:

  1. Wait until they release the fix in pytorch
  2. Amend our build and, once the bug is fixed, reverse this change
  3. Install older version of pytorch that didn't have the bug yet. again reverse once fixed

2 and 3 would be best i guess. if you go down that route, can you please create an issue and reference the PR or whatever we can from PyTorch repo?

@aaronkl
Copy link
Contributor Author

aaronkl commented May 15, 2019

ok let's go for 2 since I don't know after which pytorch version that bug occurred

@apaleyes
Copy link
Collaborator

So the build has passed, but running times are concerning: over 20 minutes on macos. @aaronkl how long does this new test run locally for you?

@aaronkl
Copy link
Contributor Author

aaronkl commented May 17, 2019

it's seems that the test for Bohamiann take much longer than necessary. I will send another PR to solve that.

@aaronkl aaronkl mentioned this pull request May 17, 2019
@apaleyes
Copy link
Collaborator

Much better times now, merging

@apaleyes apaleyes merged commit eb95c10 into EmuKit:master May 17, 2019
@aaronkl aaronkl deleted the cost_bo_loop branch May 17, 2019 13:53
marpulli pushed a commit to marpulli/emukit that referenced this pull request May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants