Skip to content

Commit

Permalink
Update GPy BO
Browse files Browse the repository at this point in the history
  • Loading branch information
sevisal committed Oct 16, 2023
1 parent 7790280 commit 46661a0
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/vai_lab/DecisionMaking/plugins/BayesianOptimisation(GPy).py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@
_PLUGIN_READABLE_NAMES = {"GPyOpt": "default",
"BayesianOptimisation": "alias",
"BayesianOptimisation_GPy": "alias",} # type:ignore
_PLUGIN_MODULE_OPTIONS = {"Type": "decision making"} # type:ignore
_PLUGIN_REQUIRED_SETTINGS = {"f": "function"} # type:ignore
_PLUGIN_OPTIONAL_SETTINGS = {"domain": "list",
"constraints": "list",
"acquisition_type ": "str",
"files": "list",
"normalize_Y": "bool",
"evaluator_type": "str",
"batch_size": "int",
"acquisition_jitter": "float"} # type:ignore
_PLUGIN_REQUIRED_DATA = {} # type:ignore
_PLUGIN_OPTIONAL_DATA = {"X","Y"} # type:ignore
_PLUGIN_MODULE_OPTIONS = {"Type": "decision making"} # type:ignore
_PLUGIN_REQUIRED_SETTINGS = {"f": "function"} # type:ignore
_PLUGIN_OPTIONAL_SETTINGS = {} # type:ignore
_PLUGIN_REQUIRED_DATA = {} # type:ignore
_PLUGIN_OPTIONAL_DATA = {"X","Y"} # type:ignore

class GPyOpt(DecisionMakingPluginT):
"""
Expand All @@ -38,7 +31,7 @@ def _parse_options_dict(self, options_dict:Dict):
options_dict['Y'] = self.Y.reshape(-1,1)
return options_dict

def optimise(self):
def run_optimization(self):
"""Sends parameters to optimizer, then runs Bayesian Optimization for a number 'max_iter' of iterations"""
try:
self.BO.run_optimization()
Expand All @@ -47,7 +40,7 @@ def optimise(self):
+str(list(self._PLUGIN_READABLE_NAMES.keys())[list(self._PLUGIN_READABLE_NAMES.values()).index('default')])+'.')
raise

def suggest_locations(self):
def suggest_next_locations(self):
"""Run a single optimization step and return the next locations to evaluate the objective.
Number of suggested locations equals to batch_size.
:returns: array, shape (n_samples,)
Expand Down

0 comments on commit 46661a0

Please sign in to comment.