syne_tune.optimizer.schedulers.searchers.bayesopt.sklearn package
- class syne_tune.optimizer.schedulers.searchers.bayesopt.sklearn.SKLearnPredictor[source]
Bases:
object
Base class for predictors generated by scikit-learn based estimators of
SKLearnEstimator
.This is only for predictors who return means and stddevs in
predict()
.- predict(X)[source]
Returns signals which are statistics of the predictive distribution at input points
inputs
.- Parameters:
inputs – Input points, shape
(n, d)
- Return type:
Tuple
[ndarray
,ndarray
]- Returns:
(means, stds)
, where predictive meansmeans
and predictive stddevsstds
have shape(n,)
- backward_gradient(input, head_gradients)[source]
Needs to be implemented only if gradient-based local optimization of an acquisition function is supported.
Computes the gradient \(\nabla 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.- Parameters:
input (
ndarray
) – Single input point \(x\), shape(d,)
head_gradients (
Dict
[str
,ndarray
]) – See above
- Return type:
ndarray
- Returns:
Gradient \(\nabla f(x)\)
- class syne_tune.optimizer.schedulers.searchers.bayesopt.sklearn.SKLearnEstimator[source]
Bases:
object
Base class scikit-learn based estimators, giving rise to surrogate models for Bayesian optimization.
- fit(X, y, update_params)[source]
Implements
fit_from_state()
, given transformed data. Here,y
is normalized (zero mean, unit variance) iffnormalize_targets == True
.- Parameters:
X (
ndarray
) – Feature matrix, shape(n_samples, n_features)
y (
ndarray
) – Target values, shape(n_samples,)
update_params (
bool
) – Should model (hyper)parameters be updated? Ignored if estimator has no hyperparameters
- Return type:
- Returns:
Predictor, wrapping the posterior state