Coverage for mlos_core/mlos_core/optimizers/bayesian_optimizers/bayesian_optimizer.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-20 00:44 +0000
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-20 00:44 +0000
1#
2# Copyright (c) Microsoft Corporation.
3# Licensed under the MIT License.
4#
5"""Contains the wrapper classes for base Bayesian optimizers."""
7from abc import ABCMeta, abstractmethod
9import numpy.typing as npt
11from mlos_core.data_classes import Suggestion
12from mlos_core.optimizers.optimizer import BaseOptimizer
15class BaseBayesianOptimizer(BaseOptimizer, metaclass=ABCMeta):
16 """Abstract base class defining the interface for Bayesian optimization."""
18 @abstractmethod
19 def surrogate_predict(self, suggestion: Suggestion) -> npt.NDArray:
20 """
21 Obtain a prediction from this Bayesian optimizer's surrogate model for the given
22 configuration(s).
24 Parameters
25 ----------
26 suggestion: Suggestion
27 The suggestion containing the configuration(s) to predict.
28 """
29 pass # pylint: disable=unnecessary-pass # pragma: no cover
31 @abstractmethod
32 def acquisition_function(self, suggestion: Suggestion) -> npt.NDArray:
33 """
34 Invokes the acquisition function from this Bayesian optimizer for the given
35 configuration.
37 Parameters
38 ----------
39 suggestion: Suggestion
40 The suggestion containing the configuration(s) to evaluate.
41 """
42 pass # pylint: disable=unnecessary-pass # pragma: no cover