- class adaptive.SKOptLearner(*args, **kwargs)#
Learn a function minimum using
This is an
scikit-optimize, with the necessary methods added to make it conform to the
function (callable) – The function to learn.
**kwargs – Arguments to pass to
- ask(n, tell_pending=True)#
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:
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.
Return the loss for the current state of the learner.
real (bool, default: True) – If False, return the “expected” loss, i.e. the loss including the as-yet unevaluated points (possibly by interpolation).
- property npoints#
Number of evaluated points.
Remove uncomputed data from the learner.
- tell(x, y, fit=True)#
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.
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 the learner that ‘x’ has been requested such that it’s not suggested again.