Skip to content

Commit

Permalink
SacessOptimizer: expose more hyperparameters + minor fixes (#1459)
Browse files Browse the repository at this point in the history
* Introduces a new SacessOptions class to collect SacessOptimizer hyperparameters and makes some previously hard-coded values configurable.

  Closes #1458

* Fixes a mismatch in adaptation conditions between the original SaCeSS implementation and SacessOptimizer (adaptation condition: AND -> OR)

* Log final worker configuration

* Sort refset before resizing.
  • Loading branch information
dweindl committed Sep 16, 2024
1 parent 36eec04 commit 5c58374
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 47 deletions.
1 change: 1 addition & 0 deletions pypesto/optimize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ESSOptimizer,
SacessFidesFactory,
SacessOptimizer,
SacessOptions,
get_default_ess_options,
)
from .load import (
Expand Down
1 change: 1 addition & 0 deletions pypesto/optimize/ess/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
from .sacess import (
SacessFidesFactory,
SacessOptimizer,
SacessOptions,
get_default_ess_options,
)
7 changes: 4 additions & 3 deletions pypesto/optimize/ess/refset.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def initialize_random(
self,
n_diverse: int,
):
"""Create initial reference set from random parameters.
"""Create an initial reference set from random parameters.
Sample ``n_diverse`` random points, populate half of the RefSet using
the best solutions and fill the rest with random points.
Expand All @@ -90,7 +90,7 @@ def initialize_random(
self.initialize_from_array(x_diverse=x_diverse, fx_diverse=fx_diverse)

def initialize_from_array(self, x_diverse: np.array, fx_diverse: np.array):
"""Create initial reference set using the provided points.
"""Create an initial reference set using the provided points.
Populate half of the RefSet using the best given solutions and fill the
rest with a random selection from the remaining points.
Expand Down Expand Up @@ -174,7 +174,8 @@ def resize(self, new_dim: int):
If the dimension does not change, do nothing.
If size is decreased, drop entries from the end (i.e., the worst
values, assuming it is sorted). If size is increased, the new
entries are filled with randomly and the refset is sorted.
entries are filled with randomly sampled parameters and the refset is
sorted.
NOTE: Any attributes are just truncated or filled with zeros.
"""
Expand Down
Loading

0 comments on commit 5c58374

Please sign in to comment.