Skip to content

Commit

Permalink
Add option to specify the scale factor for the nadir point
Browse files Browse the repository at this point in the history
  • Loading branch information
ruicoelhopedro committed Apr 23, 2024
1 parent 34823af commit 197bb84
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion piglot/optimisers/botorch/bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def __init__(
export: str = None,
device: str = 'cpu',
reference_point: List[float] = None,
nadir_scale: float = 0.1,
) -> None:
if not isinstance(objective, GenericObjective):
raise RuntimeError("Bayesian optimiser requires a GenericObjective")
Expand All @@ -169,6 +170,7 @@ def __init__(
self.partitioning: FastNondominatedPartitioning = None
self.adjusted_ref_point = reference_point is None
self.ref_point = None if reference_point is None else -torch.tensor(reference_point)
self.nadir_scale = nadir_scale
if acquisition is None:
self.acquisition = default_acquisition(
objective.composition,
Expand Down Expand Up @@ -307,7 +309,7 @@ def _update_mo_data(self, dataset: BayesDataset) -> float:
# Compute reference point if needed
if self.adjusted_ref_point:
nadir = torch.min(y_points, dim=0).values
self.ref_point = nadir - 0.1 * (torch.max(y_points, dim=0).values - nadir)
self.ref_point = nadir - self.nadir_scale * (torch.max(y_points, dim=0).values - nadir)
# Update partitioning and Pareto front
self.partitioning = FastNondominatedPartitioning(self.ref_point, Y=y_points)
hypervolume = self.partitioning.compute_hypervolume().item()
Expand Down

0 comments on commit 197bb84

Please sign in to comment.