Skip to content
Snippets Groups Projects
Commit 6a1f869e authored by Bas Nijholt's avatar Bas Nijholt
Browse files

SKOptLearner: create 'tell_pending' which deprecates 'tell(x, None)'

parent a8472d09
No related branches found
No related tags found
No related merge requests found
Pipeline #12183 failed
......@@ -27,11 +27,13 @@ class SKOptLearner(Optimizer, BaseLearner):
self.function = function
super().__init__(**kwargs)
def tell(self, x, y, fit=True):
if y is not None:
# 'skopt.Optimizer' takes care of points we
# have not got results for.
super().tell([x], y, fit)
def tell(self, x, y, fit=True):
super().tell([x], y, fit)
def tell_pending(self, x):
# 'skopt.Optimizer' takes care of points we
# have not got results for.
pass
def remove_unfinished(self):
pass
......@@ -46,7 +48,10 @@ class SKOptLearner(Optimizer, BaseLearner):
# estimator of loss, but it is the cheapest.
return 1 - model.score(self.Xi, self.yi)
def ask(self, n, add_data=True):
def ask(self, n, tell_pending=True):
if not tell_pending:
raise NotImplementedError('Asking points is an irreversible '
'action, so use `ask(n, tell_pending=True`.')
points = super().ask(n)
# TODO: Choose a better estimate for the loss improvement.
if self.space.n_dims > 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment