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()
callspredict()
for all observed and pending extended configs. This may not be exactly correct, becausepredict()
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. Onlyactive_metric
target values are considered. The target values for a pending config are a flat vector.- Parameters:
state (
TuningJobState
) – TuningJobSubStategpmodel (
GaussianProcessLearningCurveModel
) – Parameters must have been fitfantasy_samples (
List
[FantasizedPendingEvaluation
]) – See aboveactive_metric (
str
) – See parent classfilter_observed_data (
Optional
[Callable
[[Dict
[str
,Union
[int
,float
,str
]]],bool
]]) – See parent classnormalize_mean (
float
) – Mean used to normalize targetsnormalize_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)
- 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. Ifnum_fantasy_samples == 0
, pending evaluations instate
are ignored.- Parameters:
gpmodel (
GaussianProcessLearningCurveModel
) – GaussianProcessLearningCurveModelnum_fantasy_samples (
int
) – See aboveactive_metric (
str
) – Name of the metric to optimize.config_space_ext (
ExtendedConfiguration
) – ExtendedConfigurationnormalize_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
- fit_from_state(state, update_params)[source]
Creates a
Predictor
object based on data instate
. For a Bayesian model, this involves computing the posterior state, which is wrapped in thePredictor
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 fromupdate_params (
bool
) – See above
- Return type:
- Returns:
Predictor, wrapping the posterior state
- predictor_for_fantasy_samples(state, fantasy_samples)[source]
Same as
model
withfit_params=False
, butfantasy_samples
are passed in, rather than sampled here.- Parameters:
state (
TuningJobState
) – Seemodel
fantasy_samples (
List
[FantasizedPendingEvaluation
]) – See above
- Return type:
- 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