|
13 | 13 |
|
14 | 14 | # BO imports
|
15 | 15 | from kernel_tuner.searchspace import Searchspace
|
16 |
| -from kernel_tuner.strategies.common import CostFunc |
| 16 | +from kernel_tuner.strategies.common import CostFunc, get_options |
17 | 17 | from kernel_tuner.util import StopCriterionReached
|
18 | 18 |
|
19 | 19 | try:
|
|
26 | 26 |
|
27 | 27 | supported_methods = ["poi", "ei", "lcb", "lcb-srinivas", "multi", "multi-advanced", "multi-fast", "multi-ultrafast"]
|
28 | 28 |
|
| 29 | +# _options dict is used for generating documentation, but is not used to check for unsupported strategy_options in bayes_opt |
| 30 | +_options = dict( |
| 31 | + covariancekernel=( |
| 32 | + 'The Covariance kernel to use, choose any from "constantrbf", "rbf", "matern32", "matern52"', |
| 33 | + "matern32", |
| 34 | + ), |
| 35 | + covariancelengthscale=("The covariance length scale", 1.5), |
| 36 | + method=( |
| 37 | + "The Bayesian Optimization method to use, choose any from " + ", ".join(supported_methods), |
| 38 | + "multi-ultrafast", |
| 39 | + ), |
| 40 | + samplingmethod=( |
| 41 | + "Method used for initial sampling the parameter space, either random or Latin Hypercube Sampling (LHS)", |
| 42 | + "lhs", |
| 43 | + ), |
| 44 | + popsize=("Number of initial samples", 20), |
| 45 | +) |
| 46 | + |
29 | 47 |
|
30 | 48 | def generate_normalized_param_dicts(tune_params: dict, eps: float) -> Tuple[dict, dict]:
|
31 | 49 | """Generates normalization and denormalization dictionaries."""
|
@@ -92,6 +110,9 @@ def tune(searchspace: Searchspace, runner, tuning_options):
|
92 | 110 | :rtype: list(dict()), dict()
|
93 | 111 |
|
94 | 112 | """
|
| 113 | + # we don't actually use this for Bayesian Optimization, but it is used to check for unsupported options |
| 114 | + get_options(tuning_options.strategy_options, _options, unsupported=["x0"]) |
| 115 | + |
95 | 116 | max_fevals = tuning_options.strategy_options.get("max_fevals", 100)
|
96 | 117 | prune_parameterspace = tuning_options.strategy_options.get("pruneparameterspace", True)
|
97 | 118 | if not bayes_opt_present:
|
@@ -143,25 +164,6 @@ def tune(searchspace: Searchspace, runner, tuning_options):
|
143 | 164 | return cost_func.results
|
144 | 165 |
|
145 | 166 |
|
146 |
| -# _options dict is used for generating documentation, but is not used to check for unsupported strategy_options in bayes_opt |
147 |
| -_options = dict( |
148 |
| - covariancekernel=( |
149 |
| - 'The Covariance kernel to use, choose any from "constantrbf", "rbf", "matern32", "matern52"', |
150 |
| - "matern32", |
151 |
| - ), |
152 |
| - covariancelengthscale=("The covariance length scale", 1.5), |
153 |
| - method=( |
154 |
| - "The Bayesian Optimization method to use, choose any from " + ", ".join(supported_methods), |
155 |
| - "multi-ultrafast", |
156 |
| - ), |
157 |
| - samplingmethod=( |
158 |
| - "Method used for initial sampling the parameter space, either random or Latin Hypercube Sampling (LHS)", |
159 |
| - "lhs", |
160 |
| - ), |
161 |
| - popsize=("Number of initial samples", 20), |
162 |
| -) |
163 |
| - |
164 |
| - |
165 | 167 | class BayesianOptimization:
|
166 | 168 | def __init__(
|
167 | 169 | self,
|
|
0 commit comments