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

Fix intergrating hyper-parameters #237

Merged
merged 4 commits into from Sep 4, 2019
Merged

Conversation

marpulli
Copy link
Contributor

@marpulli marpulli commented Aug 6, 2019

Integrating hyper-parameters didn't work with multi-output models or acquisitions without gradients.

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 Aug 6, 2019

Codecov Report

Merging #237 into master will decrease coverage by 0.3%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #237      +/-   ##
==========================================
- Coverage    89.4%   89.09%   -0.31%     
==========================================
  Files         114      114              
  Lines        3323     3339      +16     
  Branches      359      360       +1     
==========================================
+ Hits         2971     2975       +4     
- Misses        280      291      +11     
- Partials       72       73       +1
Impacted Files Coverage Δ
emukit/model_wrappers/gpy_model_wrappers.py 77.88% <16.66%> (-7.99%) ⬇️
emukit/core/acquisition/integrated_acquisition.py 91.66% <90%> (+1.04%) ⬆️
emukit/core/optimization/optimizer.py 80.99% <0%> (-2.48%) ⬇️
...ization/acquisitions/probability_of_improvement.py 100% <0%> (+3.33%) ⬆️

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 70e992c...c72c9ed. Read the comment docs.

@@ -3,7 +3,7 @@
import numpy as np

from emukit.core.acquisition import Acquisition
from emukit.core.interfaces import IModel, IPriorHyperparameters, IDifferentiable
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't it actually used? I mean, there is definitely a call of model.evaluate_with_gradients below. I'd suggest to add this interface to model type hint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have always been confused how we should do type hints when some interfaces are optional to implement. The type hint should say "Must implement IModel and optionally implement IDifferentiable". We usually do Union[IModel, IDifferentialbe] which means "must implement both IModel and IDifferentialbe". You get warnings from the type checking system if you pass in a model that doesn't implement gradients with the current type hints.


@property
def has_gradients(self) -> bool:
"""Returns that this acquisition has gradients"""
return isinstance(self.model, IDifferentiable)
return self._has_gradients
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 cover this with a unit test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Fix model hyperparameters

"""
if self.gpy_model._fixes_ is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way in gpy to do this without calling private stuff like _fixes_ and _trigger_params_changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll investigate, this is the way the other model wrapper does it though

Copy link
Collaborator

Choose a reason for hiding this comment

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

Following our offline conversation, can you please create an issue to remind us to look deeper into this GPy magic? We may even consider contributing interface changes to GPy if necessary.

@apaleyes
Copy link
Collaborator

apaleyes commented Sep 4, 2019

This got broken after #241, and I've submitted a PR with a fix already: #244

@apaleyes apaleyes merged commit 9b73d23 into EmuKit:master Sep 4, 2019
apaleyes pushed a commit that referenced this pull request Dec 4, 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

3 participants