Skip to content

Commit

Permalink
Merge pull request #29 from aurora-multiphysics/28-allow-maximising-m…
Browse files Browse the repository at this point in the history
…etrics

✨ Allow maximising metrics in Optimiser
  • Loading branch information
lukethehuman authored Mar 7, 2024
2 parents 0f4736d + 562df94 commit 323fcbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sledo/optimiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(
max_total_trials: int,
max_concurrent_trials: int = 1,
search_alg: Searcher = AxSearch(),
mode: str = "min",
name: str = None,
data_dir: str | Path = None,
) -> None:
Expand All @@ -45,6 +46,9 @@ def __init__(
search_alg : Searcher, optional
The search algorithm to use, by default AxSearch(). Must be an
instance of a subclass of the Ray Tune Searcher base class.
mode : str
Must be "min" or "max". Sets whether the optimisation metric is
minimised or maximised, by default "min".
name : str
The name of the optimiser, will be passed to the Ray Tune tuner. By
default, None, in which case a name is constructed by concatenating
Expand Down Expand Up @@ -94,7 +98,7 @@ def __init__(
self.tuner = tune.Tuner(
self.evaluation_function,
tune_config=tune.TuneConfig(
mode="min",
mode=mode,
metric=self.metrics[0],
search_alg=self.search_alg,
num_samples=max_total_trials,
Expand Down

0 comments on commit 323fcbd

Please sign in to comment.