Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def optimize(self, acquisition: Acquisition, context: Optional[Context] = None)
the parameter name and the value is the value to fix the parameter to.
:return: A tuple of (location of maximum, acquisition value at maximum)
"""
f_maxs = np.zeros((len(self.source_parameter.domain)))
x_opts = []
f_maxs = []

if context is None:
context = dict()
Expand All @@ -75,7 +75,10 @@ def optimize(self, acquisition: Acquisition, context: Optional[Context] = None)
# Fix the source using a dictionary, the key is the name of the parameter to fix and the value is the
# value to which the parameter is fixed
context[self.source_parameter.name] = self.source_parameter.domain[i]
x, f_maxs[i] = self.acquisition_optimizer.optimize(acquisition, context)
x, f = self.acquisition_optimizer.optimize(acquisition, context)
x_opts.append(x)
f_maxs.append(f)

f_maxs = np.concatenate(f_maxs)
best_source = np.argmax(f_maxs)
return x_opts[best_source], np.max(f_maxs)
2 changes: 1 addition & 1 deletion tests/emukit/core/test_multi_source_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@pytest.fixture
def multi_source_optimizer():
mock_acquisition_optimizer = mock.create_autospec(GradientAcquisitionOptimizer)
mock_acquisition_optimizer.optimize.return_value = (np.array([[0.0]]), None)
mock_acquisition_optimizer.optimize.return_value = (np.array([[0.0]]), np.array([[0.0]]))
space = ParameterSpace([ContinuousParameter("x", 0, 1), InformationSourceParameter(2)])
return MultiSourceAcquisitionOptimizer(mock_acquisition_optimizer, space)

Expand Down