Skip to content

Commit

Permalink
Implement ValidateAlgorithmSettings for hyperopt (kubeflow#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bata committed Apr 9, 2020
1 parent ab3dab0 commit 762e6a0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
8 changes: 4 additions & 4 deletions pkg/suggestion/v1alpha3/chocolate/base_chocolate_service.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json
import numpy as np
import chocolate as choco
import logging
import base64

from pkg.suggestion.v1alpha3.internal.search_space import *
from pkg.suggestion.v1alpha3.internal.trial import *
from pkg.suggestion.v1alpha3.internal.search_space import (
INTEGER, DOUBLE, CATEGORICAL, DISCRETE, MAX_GOAL,
)
from pkg.suggestion.v1alpha3.internal.trial import Assignment

logger = logging.getLogger(__name__)

Expand Down
8 changes: 5 additions & 3 deletions pkg/suggestion/v1alpha3/hyperopt/base_hyperopt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
import numpy as np
import logging

from pkg.suggestion.v1alpha3.internal.search_space import *
from pkg.suggestion.v1alpha3.internal.trial import *
from pkg.suggestion.v1alpha3.internal.search_space import (
INTEGER, DOUBLE, CATEGORICAL, DISCRETE, MAX_GOAL,
)
from pkg.suggestion.v1alpha3.internal.trial import Assignment

logger = logging.getLogger(__name__)

TPE_ALGORITHM_NAME = "tpe"
RANDOM_ALGORITHM_NAME = "random"


class BaseHyperoptService(object):
def __init__(self, algorithm_name=TPE_ALGORITHM_NAME, random_state=None, search_space=None):
self.algorithm_name = algorithm_name
Expand Down Expand Up @@ -64,7 +67,6 @@ def create_fmin(self):

self.fmin.catch_eval_exceptions = False


def getSuggestions(self, trials, request_number):
"""
Get the new suggested trials with the given algorithm.
Expand Down
3 changes: 3 additions & 0 deletions pkg/suggestion/v1alpha3/hyperopt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def GetSuggestions(self, request, context):
parameter_assignments=Assignment.generate(new_assignments)
)

def ValidateAlgorithmSettings(self, request, context):
return api_pb2.ValidateAlgorithmSettingsReply()


class OptimizerConfiguration(object):
def __init__(self, random_state=None):
Expand Down
Empty file.
12 changes: 6 additions & 6 deletions pkg/suggestion/v1alpha3/skopt/base_skopt_service.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json
import numpy as np
import skopt
import datetime
import logging
import skopt

from pkg.suggestion.v1alpha3.internal.search_space import *
from pkg.suggestion.v1alpha3.internal.trial import *
import datetime
from pkg.suggestion.v1alpha3.internal.search_space import (
INTEGER, DOUBLE, CATEGORICAL, DISCRETE, MAX_GOAL,
)
from pkg.suggestion.v1alpha3.internal.trial import Assignment

logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 762e6a0

Please sign in to comment.