Coverage for mlos_core/mlos_core/tests/optimizers/conftest.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.7, created at 2024-11-22 01:18 +0000
« prev ^ index » next coverage.py v7.6.7, created at 2024-11-22 01:18 +0000
1#
2# Copyright (c) Microsoft Corporation.
3# Licensed under the MIT License.
4#
5"""Test fixtures for mlos_bench optimizers."""
7import ConfigSpace as CS
8import pytest
11@pytest.fixture
12def configuration_space() -> CS.ConfigurationSpace:
13 """Test fixture to produce a config space with all types of hyperparameters."""
14 # Start defining a ConfigurationSpace for the Optimizer to search.
15 space = CS.ConfigurationSpace(seed=1234)
16 # Add a continuous input dimension between 0 and 1.
17 space.add(CS.UniformFloatHyperparameter(name="x", lower=0, upper=1))
18 # Add a categorical hyperparameter with 3 possible values.
19 space.add(CS.CategoricalHyperparameter(name="y", choices=["a", "b", "c"]))
20 # Add a discrete input dimension between 0 and 10.
21 space.add(CS.UniformIntegerHyperparameter(name="z", lower=0, upper=10))
22 return space