-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert features and constraints to entmoot * EntingStrategy functional and datamodel * Ask implemented for Enting with example * Convert Enting to Predictive * Implement multi objective and maximization * Refactor, move files to appropriate directories * Enting docstrings and test for domain conversion * Multiple candidates generated in ask * Implement new entmoot constraints * Implement new entmoot Maximize objective * Implement new entmoot EntingParams * Implement entmoot.ConstraintList * Create data models for Enting parameters * Update field default factory for entingparams Co-authored-by: Johannes P. Dürholt <[email protected]> * Test serialization for enting * Intial Enting tests, add to bofire api * Add tests for functionality of Enting Stratey * Update bofire/data_models/strategies/predictives/enting.py Co-authored-by: Johannes P. Dürholt <[email protected]> * Typing updates to enting * Merge entmoot utils into enting * Fix assumed ordering of features in tests * Create entmoot extra * Flatten Enting parameters * Enting tests for parameter consistency * Add specs test for entmoot * Clarified behaviour of kappa_fantasy in enting * Clean up batch proposals for enting * Safer imports in test_enting * Move enting helper methods * Fix enting imports/installs; minor bugs in tests * Fix import-dependent type hints * Commit to trigger workflow * Fix problematic imports in test_enting * Add entmoot to tests that need it * More changes to fix pipeline * Add ignores for pyright * Check if gurobi license is available; remove notebook * Mark tests requiring Gurobi as slow * Add EntingStrategy to types * Add Enting to mapper --------- Co-authored-by: Johannes P. Dürholt <[email protected]>
- Loading branch information
Showing
10 changed files
with
731 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
from typing import Any, Dict, Literal, Type | ||
|
||
from pydantic import PositiveFloat, PositiveInt | ||
|
||
from bofire.data_models.constraints.api import ( | ||
Constraint, | ||
LinearEqualityConstraint, | ||
LinearInequalityConstraint, | ||
NChooseKConstraint, | ||
) | ||
from bofire.data_models.features.api import ( | ||
CategoricalDescriptorInput, | ||
CategoricalInput, | ||
ContinuousInput, | ||
ContinuousOutput, | ||
DiscreteInput, | ||
Feature, | ||
) | ||
from bofire.data_models.objectives.api import ( | ||
MaximizeObjective, | ||
MinimizeObjective, | ||
Objective, | ||
) | ||
from bofire.data_models.strategies.predictives.predictive import PredictiveStrategy | ||
|
||
|
||
class EntingStrategy(PredictiveStrategy): | ||
type: Literal["EntingStrategy"] = "EntingStrategy" | ||
|
||
# uncertainty model parameters | ||
beta: PositiveFloat = 1.96 | ||
bound_coeff: PositiveFloat = 0.5 | ||
acq_sense: Literal["exploration", "penalty"] = "exploration" | ||
dist_trafo: Literal["normal", "standard"] = "normal" | ||
dist_metric: Literal["euclidean_squared", "l1", "l2"] = "euclidean_squared" | ||
cat_metric: Literal["overlap", "of", "goodall4"] = "overlap" | ||
|
||
# lightgbm training hyperparameters | ||
# see https://lightgbm.readthedocs.io/en/latest/Parameters.html | ||
num_boost_round: PositiveInt = 100 | ||
max_depth: PositiveInt = 3 | ||
min_data_in_leaf: PositiveInt = 1 | ||
min_data_per_group: PositiveInt = 1 | ||
verbose: Literal[-1, 0, 1, 2] = -1 | ||
|
||
# pyomo parameters | ||
solver_name: str = "gurobi" | ||
solver_verbose: bool = False | ||
solver_params: Dict[str, Any] = {} | ||
|
||
# kappa_fantasy determines a bound on the predicted value of an unseen point | ||
# used for making batch predictions, y* = mean + kappa_fantasy * std | ||
# for a both min and max problems, a positive value is 'pesimistic' | ||
# and a negative value is 'optimistic' | ||
# a value of zero implies future observations will be exactly the mean | ||
kappa_fantasy: float = 1.96 | ||
|
||
@classmethod | ||
def is_constraint_implemented(cls, my_type: Type[Constraint]) -> bool: | ||
return my_type in [ | ||
LinearEqualityConstraint, | ||
LinearInequalityConstraint, | ||
NChooseKConstraint, | ||
] | ||
|
||
@classmethod | ||
def is_feature_implemented(cls, my_type: Type[Feature]) -> bool: | ||
return my_type in [ | ||
CategoricalInput, | ||
DiscreteInput, | ||
CategoricalDescriptorInput, | ||
ContinuousInput, | ||
ContinuousOutput, | ||
] | ||
|
||
@classmethod | ||
def is_objective_implemented(cls, my_type: Type[Objective]) -> bool: | ||
return my_type in [MinimizeObjective, MaximizeObjective] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.