syne_tune.optimizer.schedulers.searchers.bayesopt.models.meanstd_acqfunc module

class syne_tune.optimizer.schedulers.searchers.bayesopt.models.meanstd_acqfunc.HeadWithGradient(hval, gradient)[source]

Bases: object

gradient maps each output model to a dict of head gradients, whose keys are those used by predict (e.g., mean, std)

hval: ndarray
gradient: Dict[str, Dict[str, ndarray]]
class syne_tune.optimizer.schedulers.searchers.bayesopt.models.meanstd_acqfunc.CurrentBestProvider[source]

Bases: object

Helper class for MeanStdAcquisitionFunction. The current_best values required in compute_acq() and compute_acq_with_gradient() may depend on the MCMC sample index for each model (if none of the models use MCMC, this index is always (0, 0, ..., 0)).

class syne_tune.optimizer.schedulers.searchers.bayesopt.models.meanstd_acqfunc.NoneCurrentBestProvider[source]

Bases: CurrentBestProvider

class syne_tune.optimizer.schedulers.searchers.bayesopt.models.meanstd_acqfunc.ActiveMetricCurrentBestProvider(active_metric_current_best)[source]

Bases: CurrentBestProvider

Default implementation in which current_best depends on the active metric only.

class syne_tune.optimizer.schedulers.searchers.bayesopt.models.meanstd_acqfunc.MeanStdAcquisitionFunction(predictor, active_metric=None)[source]

Bases: AcquisitionFunction

Base class for standard acquisition functions which depend on predictive mean and stddev. Subclasses have to implement the head and its derivatives w.r.t. mean and std:

\[f(x, \mathrm{model}) = h(\mathrm{mean}, \mathrm{std}, \mathrm{model.current_best}())\]

If model is a Predictor, then active_metric is ignored. If model is a dict mapping output names to models, then active_metric must be given.

Note that acquisition functions will always be minimized!

compute_acq(inputs, predictor=None)[source]

Note: If inputs has shape (d,), it is taken to be (1, d)

Parameters:
  • inputs (ndarray) – Encoded input points, shape (n, d)

  • predictor (Union[Predictor, Dict[str, Predictor], None]) – If given, overrides self.predictor

Return type:

ndarray

Returns:

Acquisition function values, shape (n,)

compute_acq_with_gradient(input, predictor=None)[source]

For a single input point \(x\), compute acquisition function value \(f(x)\) and gradient \(\nabla_x f(x)\).

Parameters:
  • input (ndarray) – Single input point \(x\), shape (d,)

  • predictor (Union[Predictor, Dict[str, Predictor], None]) – If given, overrides self.predictor

Return type:

(float, ndarray)

Returns:

\((f(x), \nabla_x f(x))\)