Optimizers
bocoel.core.optim
bocoel.Optimizer
Optimizer(query_eval: QueryEvaluator, boundary: Boundary, **kwargs: Any)
Bases: Protocol
Source code in bocoel/core/optim/interfaces/optim.py
21 22 23 24 25 |
|
step abstractmethod
step() -> Mapping[int, float]
Performs a few steps of optimization. Raises StopIteration if done.
Returns
The state change of the optimizer during the step.
Source code in bocoel/core/optim/interfaces/optim.py
34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
save
save(path: str | Path) -> None
Saves the optimizer to a file.
Parameters
path: str | Path
The path to save the optimizer to.
Source code in bocoel/core/optim/interfaces/optim.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
bocoel.AxServiceOptimizer
AxServiceOptimizer(
query_eval: QueryEvaluator,
boundary: Boundary,
*,
sobol_steps: int = 0,
device: Device = "cpu",
workers: int = 1,
task: Task = Task.EXPLORE,
acqf: str | AcquisitionFunc = AcquisitionFunc.AUTO,
surrogate: str | SurrogateModel = SurrogateModel.AUTO,
surrogate_kwargs: SurrogateOptions | None = None
)
Bases: Optimizer
The Ax optimizer that uses the service API. See https://ax.dev/tutorials/gpei_hartmann_service.html
Source code in bocoel/core/optim/ax/optim.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
save
save(path: str | Path) -> None
Saves the optimizer to a file.
Parameters
path: str | Path
The path to save the optimizer to.
Source code in bocoel/core/optim/interfaces/optim.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
bocoel.Task
Bases: StrEnum
EXPLORE class-attribute
instance-attribute
EXPLORE = 'EXPLORE'
MINIMIZE class-attribute
instance-attribute
MINIMIZE = 'MINIMIZE'
MAXIMIZE class-attribute
instance-attribute
MAXIMIZE = 'MAXIMIZE'
lookup classmethod
lookup(name: str | Self) -> Self
Source code in bocoel/common/enums.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
bocoel.AcquisitionFunc
Bases: StrEnum
ENTROPY class-attribute
instance-attribute
ENTROPY = 'ENTROPY'
MES class-attribute
instance-attribute
MES = 'MAX_VALUE_ENTROPY'
UCB class-attribute
instance-attribute
UCB = 'UPPER_CONFIDENCE_BOUND'
QUCB class-attribute
instance-attribute
QUCB = 'QUASI_UPPER_CONFIDENCE_BOUND'
EI class-attribute
instance-attribute
EI = 'EXPECTED_IMPROVEMENT'
QEI class-attribute
instance-attribute
QEI = 'QUASI_EXPECTED_IMPROVEMENT'
AUTO class-attribute
instance-attribute
AUTO = 'AUTO'
botorch_acqf_class property
botorch_acqf_class: type[AcquisitionFunction] | None
lookup classmethod
lookup(name: str | Self) -> Self
Source code in bocoel/common/enums.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
bocoel.core.optim.ax.surrogates.SurrogateModel
Bases: StrEnum
SAAS class-attribute
instance-attribute
SAAS = 'SAAS'
AUTO class-attribute
instance-attribute
AUTO = 'AUTO'
lookup classmethod
lookup(name: str | Self) -> Self
Source code in bocoel/common/enums.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
surrogate
surrogate(surrogate_options: SurrogateOptions | None) -> Surrogate | None
Source code in bocoel/core/optim/ax/surrogates/supported.py
25 26 27 28 29 30 31 32 33 34 35 36 |
|
bocoel.core.optim.ax.surrogates.SurrogateOptions
Bases: TypedDict
mll_class instance-attribute
mll_class: NotRequired[type[MarginalLogLikelihood]]
mll_options instance-attribute
mll_options: NotRequired[MLLOptions]
bocoel.KMeansOptimizer
KMeansOptimizer(
query_eval: QueryEvaluator,
boundary: Boundary,
*,
batch_size: int,
embeddings: NDArray,
model_kwargs: KMeansOptions
)
Bases: ScikitLearnOptimizer
Source code in bocoel/core/optim/sklearn/kmeans.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
save
save(path: str | Path) -> None
Saves the optimizer to a file.
Parameters
path: str | Path
The path to save the optimizer to.
Source code in bocoel/core/optim/interfaces/optim.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
bocoel.KMeansOptions
Bases: TypedDict
n_clusters instance-attribute
n_clusters: int
init instance-attribute
init: NotRequired[Literal['k-means++', 'random']]
n_init instance-attribute
n_init: NotRequired[int | Literal['auto']]
tol instance-attribute
tol: NotRequired[float]
verbose instance-attribute
verbose: NotRequired[int]
random_state instance-attribute
random_state: NotRequired[int]
algorithm instance-attribute
algorithm: NotRequired[Literal['llyod', 'elkan']]
bocoel.KMedoidsOptimizer
KMedoidsOptimizer(
query_eval: QueryEvaluator,
boundary: Boundary,
*,
batch_size: int,
embeddings: NDArray,
model_kwargs: KMedoidsOptions
)
Bases: ScikitLearnOptimizer
Source code in bocoel/core/optim/sklearn/kmedoids.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
save
save(path: str | Path) -> None
Saves the optimizer to a file.
Parameters
path: str | Path
The path to save the optimizer to.
Source code in bocoel/core/optim/interfaces/optim.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
bocoel.KMedoidsOptions
Bases: TypedDict
n_clusters instance-attribute
n_clusters: int
metrics instance-attribute
metrics: NotRequired[str]
method instance-attribute
method: NotRequired[Literal['alternate', 'pam']]
init instance-attribute
init: NotRequired[Literal['random', 'heuristic', 'kmedoids++', 'build']]
max_iter instance-attribute
max_iter: NotRequired[int]
random_state instance-attribute
random_state: NotRequired[int]
bocoel.RandomOptimizer
RandomOptimizer(
query_eval: QueryEvaluator,
boundary: Boundary,
*,
samples: int,
batch_size: int
)
Bases: Optimizer
Source code in bocoel/core/optim/random.py
17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
save
save(path: str | Path) -> None
Saves the optimizer to a file.
Parameters
path: str | Path
The path to save the optimizer to.
Source code in bocoel/core/optim/interfaces/optim.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
bocoel.UniformOptimizer
UniformOptimizer(
query_eval: QueryEvaluator,
boundary: Boundary,
*,
grids: Sequence[int],
batch_size: int
)
Bases: Optimizer
Source code in bocoel/core/optim/uniform.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
save
save(path: str | Path) -> None
Saves the optimizer to a file.
Parameters
path: str | Path
The path to save the optimizer to.
Source code in bocoel/core/optim/interfaces/optim.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
bocoel.QueryEvaluator
Bases: Protocol
__call__ abstractmethod
__call__(query: ArrayLike) -> OrderedDict[int, float]
Evaluates the given batched query. The order of the results must be kept in the original order.
Source code in bocoel/core/optim/interfaces/evals.py
17 18 19 20 21 22 23 24 |
|
bocoel.SearchEvaluator
Bases: Protocol