Skip to content

Commit

Permalink
fix: Remove prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <gaoce@caicloud.io>
  • Loading branch information
gaocegege committed Sep 23, 2019
1 parent ac32121 commit be46d11
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/suggestion/v1alpha3/chocolate/base_chocolate_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def getSuggestions(self, search_space, trials, request_number):

conn = choco.SQLiteConnection("sqlite:///my_db.db")
# Refer to https://chocolate.readthedocs.io/tutorials/algo.html
if self.algorithm_name == "chocolate-grid" or self.algorithm_name == "grid":
if self.algorithm_name == "grid":
sampler = choco.Grid(conn, chocolate_search_space, clear_db=True)
# hyperopt-random is the default option in katib.
elif self.algorithm_name == "chocolate-random":
sampler = choco.Random(conn, chocolate_search_space, clear_db=True)
elif self.algorithm_name == "chocolate-quasirandom":
Expand Down
4 changes: 2 additions & 2 deletions pkg/suggestion/v1alpha3/hyperopt/base_hyperopt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

class BaseHyperoptService(object):
def __init__(self, algorithm_name="tpe"):
if algorithm_name == 'hyperopt-tpe' or algorithm_name == 'tpe':
if algorithm_name == 'tpe':
self.hyperopt_algorithm = hyperopt.tpe.suggest
elif algorithm_name == 'hyperopt-random' or algorithm_name == 'random':
elif algorithm_name == 'random':
self.hyperopt_algorithm = hyperopt.rand.suggest
# elif algorithm_name == 'hyperopt-anneal':
# self.hyperopt_algorithm = hyperopt.anneal.suggest_batch
Expand Down
5 changes: 2 additions & 3 deletions pkg/suggestion/v1alpha3/skopt/base_skopt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ def getSuggestions(self, search_space, trials, request_number):
skopt_search_space.append(
skopt.space.Categorical(param.list, name=param.name))

if self.algorithm_name != "skopt-bayesian-optimization" or \
self.algorithm_name != "bayesianoptimization":
if self.algorithm_name != "bayesianoptimization":
raise Exception(
"Algorithm name is not supported by skopt service.")
'"Failed to create the algortihm: {}'.format(self.algorithm_name))
skopt_optimizer = skopt.Optimizer(skopt_search_space,
base_estimator=self.base_estimator,
n_initial_points=self.n_initial_points,
Expand Down

0 comments on commit be46d11

Please sign in to comment.