13
13
# limitations under the License.
14
14
15
15
import logging
16
- from pkg .apis .manager .v1beta1 .python import api_pb2 as api
17
16
18
- from pkg .suggestion .v1beta1 .internal .constant import *
17
+ from pkg .apis .manager .v1beta1 .python import api_pb2 as api
18
+ import pkg .suggestion .v1beta1 .internal .constant as constant
19
19
20
20
21
21
logging .basicConfig (level = logging .DEBUG )
@@ -31,9 +31,9 @@ def __init__(self):
31
31
def convert (experiment ):
32
32
search_space = HyperParameterSearchSpace ()
33
33
if experiment .spec .objective .type == api .MAXIMIZE :
34
- search_space .goal = MAX_GOAL
34
+ search_space .goal = constant . MAX_GOAL
35
35
elif experiment .spec .objective .type == api .MINIMIZE :
36
- search_space .goal = MIN_GOAL
36
+ search_space .goal = constant . MIN_GOAL
37
37
for p in experiment .spec .parameter_specs .parameters :
38
38
search_space .params .append (
39
39
HyperParameterSearchSpace .convertParameter (p ))
@@ -72,7 +72,7 @@ def __init__(self, name, type_, min_, max_, list_, step):
72
72
self .step = step
73
73
74
74
def __str__ (self ):
75
- if self .type == INTEGER or self .type == DOUBLE :
75
+ if self .type == constant . INTEGER or self .type == constant . DOUBLE :
76
76
return "HyperParameter(name: {}, type: {}, min: {}, max: {}, step: {})" .format (
77
77
self .name , self .type , self .min , self .max , self .step )
78
78
else :
@@ -81,16 +81,16 @@ def __str__(self):
81
81
82
82
@staticmethod
83
83
def int (name , min_ , max_ , step ):
84
- return HyperParameter (name , INTEGER , min_ , max_ , [], step )
84
+ return HyperParameter (name , constant . INTEGER , min_ , max_ , [], step )
85
85
86
86
@staticmethod
87
87
def double (name , min_ , max_ , step ):
88
- return HyperParameter (name , DOUBLE , min_ , max_ , [], step )
88
+ return HyperParameter (name , constant . DOUBLE , min_ , max_ , [], step )
89
89
90
90
@staticmethod
91
91
def categorical (name , lst ):
92
- return HyperParameter (name , CATEGORICAL , 0 , 0 , [str (e ) for e in lst ], 0 )
92
+ return HyperParameter (name , constant . CATEGORICAL , 0 , 0 , [str (e ) for e in lst ], 0 )
93
93
94
94
@staticmethod
95
95
def discrete (name , lst ):
96
- return HyperParameter (name , DISCRETE , 0 , 0 , [str (e ) for e in lst ], 0 )
96
+ return HyperParameter (name , constant . DISCRETE , 0 , 0 , [str (e ) for e in lst ], 0 )
0 commit comments