Bases: skopt.optimizer.optimizer.Optimizer, adaptive.learner.base_learner.BaseLearner

Learn a function minimum using skopt.Optimizer.

This is an Optimizer from scikit-optimize, with the necessary methods added to make it conform to the adaptive learner interface.

Parameters
• function (callable) – The function to learn.

• **kwargs – Arguments to pass to skopt.Optimizer.

Query point or multiple points at which objective should be evaluated.

n_pointsint or None, default: None

Number of points returned by the ask method. If the value is None, a single point to evaluate is returned. Otherwise a list of points to evaluate is returned of size n_points. This is useful if you can evaluate your objective in parallel, and thus obtain more objective function evaluations per unit of time.

strategystring, default: “cl_min”

Method to use to sample multiple points (see also n_points description). This parameter is ignored if n_points = None. Supported options are “cl_min”, “cl_mean” or “cl_max”.

• If set to “cl_min”, then constant liar strategy is used

with lie objective value being minimum of observed objective values. “cl_mean” and “cl_max” means mean and max of values respectively. For details on this strategy see:

https://hal.archives-ouvertes.fr/hal-00732512/document

With this strategy a copy of optimizer is created, which is then asked for a point, and the point is told to the copy of optimizer with some fake objective (lie), the next point is asked from copy, it is also told to the copy with fake objective and so on. The type of lie defines different flavours of cl_x strategies.

data: dict#
loss(real=True)[source]#

Return the loss for the current state of the learner.

Parameters

real (bool, default: True) – If False, return the “expected” loss, i.e. the loss including the as-yet unevaluated points (possibly by interpolation).

new() [source]#

Return a new SKOptLearner without the data.

property npoints#

Number of evaluated points.

pending_points: set#
plot(nsamples=200)[source]#
remove_unfinished()[source]#

Remove uncomputed data from the learner.

tell(x, y, fit=True)[source]#

Record an observation (or several) of the objective function.

Provide values of the objective function at points suggested by ask() or other points. By default a new model will be fit to all observations. The new model is used to suggest the next point at which to evaluate the objective. This point can be retrieved by calling ask().

To add observations without fitting a new model set fit to False.

To add multiple observations in a batch pass a list-of-lists for x and a list of scalars for y.

Parameters
• x (list or list-of-lists) – Point at which objective was evaluated.

• y (scalar or list) – Value of objective at x.

• fit (bool, default: True) – Fit a model to observed evaluations of the objective. A model will only be fitted after n_initial_points points have been told to the optimizer irrespective of the value of fit.

tell_pending(x)[source]#

Tell the learner that ‘x’ has been requested such that it’s not suggested again.