Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

initialize context and num_acquisitions #171

Merged
merged 1 commit into from
Mar 19, 2018

Conversation

befelix
Copy link
Contributor

@befelix befelix commented Mar 14, 2018

Minor change that initializes context and num_acquisitions in __init__. Without this, the following code raises an error about missing variables.

import GPyOpt

def fun(x):
    return x

bounds = [{'name': 'var_1', 'type': 'continuous', 'domain': (-1,1)}]

opt = GPyOpt.methods.BayesianOptimization(fun, bounds)

opt._update_model()
opt._compute_next_evaluations()

@codecov-io
Copy link

codecov-io commented Mar 14, 2018

Codecov Report

Merging #171 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #171      +/-   ##
==========================================
+ Coverage   77.06%   77.07%   +0.01%     
==========================================
  Files          92       92              
  Lines        4230     4232       +2     
==========================================
+ Hits         3260     3262       +2     
  Misses        970      970
Impacted Files Coverage Δ
GPyOpt/core/bo.py 57.81% <100%> (+0.4%) ⬆️

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 333023b...baf5230. Read the comment docs.

@apaleyes
Copy link
Collaborator

These methods are marked private, so no user is supposed to use them directly. Is there a scenario when leaving these variables uninitialized throws an exception while calling public methods?

@befelix
Copy link
Contributor Author

befelix commented Mar 19, 2018 via email

@apaleyes
Copy link
Collaborator

Not that I disagree with the actual change, I was wandering more if there is a legit set of steps that you just have chosen not to use here because it was more verbose.

Although generally if a sequence of private method calls leads to an exception I don't see it as a problem, in this case the change makes sense regardless.

@apaleyes apaleyes merged commit e0cbcde into SheffieldML:master Mar 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants