Skip to content

Commit

Permalink
Added warning for combinatorial explosion
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Stone committed Sep 19, 2024
1 parent 958b386 commit 74b7f32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions obsidian/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ class UnfitError(Exception):
class DataWarning(UserWarning):
"""Warning that gets raised if there is an issue with input data"""
pass


class OptimizerWarning(UserWarning):
"""Warning that gets raised if there is an issue with optimization configuration"""
pass
6 changes: 5 additions & 1 deletion obsidian/optimizer/bayesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from obsidian.surrogates import model_class_dict
from obsidian.objectives import Index_Objective, Objective_Sequence
from obsidian.constraints import Linear_Constraint, Nonlinear_Constraint, Output_Constraint
from obsidian.exceptions import IncompatibleObjectiveError, UnsupportedError, UnfitError, DataWarning
from obsidian.exceptions import IncompatibleObjectiveError, UnsupportedError, UnfitError, DataWarning, OptimizerWarning
from obsidian.config import TORCH_DTYPE

from botorch.acquisition.objective import MCAcquisitionObjective
Expand Down Expand Up @@ -713,6 +713,10 @@ def suggest(self,

# Compute static variable inputs
fixed_features_list = self._fixed_features(fixed_var)
if len(fixed_features_list) > 25:
warnings.warn(f'The combinations of discrete features is large at {len(fixed_features_list)}.'
+ ' Optimization will proceed very slowly due to the combinatorial explosion.'
+ ' Recommend reducing the number of discrete parameters used.', OptimizerWarning)

# Set up the sampler, for MC-based optimization of acquisition functions
if not isinstance(model, ModelListGP):
Expand Down

0 comments on commit 74b7f32

Please sign in to comment.