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

class syne_tune.optimizer.schedulers.searchers.bayesopt.models.gpiss_model.GaussProcAdditivePredictor(state, gpmodel, fantasy_samples, active_metric, filter_observed_data=None, normalize_mean=0.0, normalize_std=1.0)[source]

Bases: BasePredictor

Gaussian Process additive surrogate model, where model parameters are fit by marginal likelihood maximization.

Note: predict_mean_current_candidates() calls predict() for all observed and pending extended configs. This may not be exactly correct, because predict() is not meant to be used for configs which have observations (it IS correct at \(r = r_{max}\)).

fantasy_samples contains the sampled (normalized) target values for pending configs. Only active_metric target values are considered. The target values for a pending config are a flat vector.

Parameters:
  • state (TuningJobState) – TuningJobSubState

  • gpmodel (GaussianProcessLearningCurveModel) – Parameters must have been fit

  • fantasy_samples (List[FantasizedPendingEvaluation]) – See above

  • active_metric (str) – See parent class

  • filter_observed_data (Optional[Callable[[Dict[str, Union[int, float, str]]], bool]]) – See parent class

  • normalize_mean (float) – Mean used to normalize targets

  • normalize_std (float) – Stddev used to normalize targets

predict(inputs)[source]

Input features inputs are w.r.t. extended configs (x, r).

Parameters:

inputs (ndarray) – Input features

Return type:

List[Dict[str, ndarray]]

Returns:

Predictive means, stddevs

backward_gradient(input, head_gradients)[source]

Computes the gradient \(\nabla_x f(x)\) for an acquisition function \(f(x)\), where \(x\) is a single input point. This is using reverse mode differentiation, the head gradients are passed by the acquisition function. The head gradients are \(\partial_k f\), where \(k\) runs over the statistics returned by predict() for the single input point \(x\). The shape of head gradients is the same as the shape of the statistics.

Lists have > 1 entry if MCMC is used, otherwise they are all size 1.

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

  • head_gradients (List[Dict[str, ndarray]]) – See above

Return type:

List[ndarray]

Returns:

Gradient \(\nabla_x f(x)\) (several if MCMC is used)

does_mcmc()[source]
property posterior_states: List[GaussProcAdditivePosteriorState] | None
class syne_tune.optimizer.schedulers.searchers.bayesopt.models.gpiss_model.GaussProcAdditiveEstimator(gpmodel, num_fantasy_samples, active_metric, config_space_ext, normalize_targets=False, debug_log=None, filter_observed_data=None)[source]

Bases: Estimator

If num_fantasy_samples > 0, we draw this many fantasy targets independently, while each sample is dependent over all pending evaluations. If num_fantasy_samples == 0, pending evaluations in state are ignored.

Parameters:
  • gpmodel (GaussianProcessLearningCurveModel) – GaussianProcessLearningCurveModel

  • num_fantasy_samples (int) – See above

  • active_metric (str) – Name of the metric to optimize.

  • config_space_ext (ExtendedConfiguration) – ExtendedConfiguration

  • normalize_targets (bool) – Normalize observed target values?

  • debug_log (Optional[DebugLogPrinter]) – DebugLogPrinter (optional)

  • filter_observed_data (Optional[Callable[[Dict[str, Union[int, float, str]]], bool]]) – Filter for observed data before computing incumbent

property debug_log: DebugLogPrinter | None
get_params()[source]
Returns:

Current tunable model parameters

set_params(param_dict)[source]
Parameters:

param_dict – New model parameters

fit_from_state(state, update_params)[source]

Creates a Predictor object based on data in state. For a Bayesian model, this involves computing the posterior state, which is wrapped in the Predictor object.

If the model also has (hyper)parameters, these are learned iff update_params == True. Otherwise, these parameters are not changed, but only the posterior state is computed. The idea is that in general, model fitting is much more expensive than just creating the final posterior state (or predictor). It then makes sense to partly work with stale model parameters.

If your surrogate model is not Bayesian, or does not have hyperparameters, you can ignore the update_params argument,

Parameters:
  • state (TuningJobState) – Current data model parameters are to be fit on, and the posterior state is to be computed from

  • update_params (bool) – See above

Return type:

Predictor

Returns:

Predictor, wrapping the posterior state

predictor_for_fantasy_samples(state, fantasy_samples)[source]

Same as model with fit_params=False, but fantasy_samples are passed in, rather than sampled here.

Parameters:
Return type:

Predictor

Returns:

See model

configure_scheduler(scheduler)[source]

Called by configure_scheduler() of searchers which make use of an class:Estimator. Allows the estimator to depend on parameters of the scheduler.

Parameters:

scheduler – Scheduler object