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