diff --git a/.gitignore b/.gitignore index a63e4accd35..45fb7d0746a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +# python ignore files +__pycache__/ +.idea/ + # Project specific ignore files *.swp bin diff --git a/api/python/api_pb2.py b/api/python/api_pb2.py new file mode 100644 index 00000000000..7f51197fdba --- /dev/null +++ b/api/python/api_pb2.py @@ -0,0 +1,2065 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: api.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='api.proto', + package='api', + syntax='proto3', + serialized_pb=_b('\n\tapi.proto\x12\x03\x61pi\"7\n\rFeasibleSpace\x12\x0b\n\x03max\x18\x01 \x01(\t\x12\x0b\n\x03min\x18\x02 \x01(\t\x12\x0c\n\x04list\x18\x03 \x03(\t\"q\n\x0fParameterConfig\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\x0eparameter_type\x18\x02 \x01(\x0e\x32\x12.api.ParameterType\x12$\n\x08\x66\x65\x61sible\x18\x03 \x01(\x0b\x32\x12.api.FeasibleSpace\"T\n\tParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12*\n\x0eparameter_type\x18\x02 \x01(\x0e\x32\x12.api.ParameterType\x12\r\n\x05value\x18\x03 \x01(\t\"&\n\x07Metrics\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"<\n\rEvaluationLog\x12\x0c\n\x04time\x18\x01 \x01(\t\x12\x1d\n\x07metrics\x18\x02 \x03(\x0b\x32\x0c.api.Metrics\"2\n\x13SuggestionParameter\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\"\n\x03Tag\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"&\n\tMountConf\x12\x0b\n\x03pvc\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\"\xcb\x01\n\x05Trial\x12\x10\n\x08trial_id\x18\x01 \x01(\t\x12\x10\n\x08study_id\x18\x02 \x01(\t\x12%\n\rparameter_set\x18\x03 \x03(\x0b\x32\x0e.api.Parameter\x12\x1f\n\x06status\x18\x04 \x01(\x0e\x32\x0f.api.TrialState\x12%\n\teval_logs\x18\x05 \x03(\x0b\x32\x12.api.EvaluationLog\x12\x17\n\x0fobjective_value\x18\x06 \x01(\t\x12\x16\n\x04tags\x18\x07 \x03(\x0b\x32\x08.api.Tag\"\xd0\x04\n\x0bStudyConfig\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05owner\x18\x02 \x01(\t\x12\x30\n\x11optimization_type\x18\x03 \x01(\x0e\x32\x15.api.OptimizationType\x12\x19\n\x11optimization_goal\x18\x04 \x01(\x01\x12<\n\x11parameter_configs\x18\x05 \x01(\x0b\x32!.api.StudyConfig.ParameterConfigs\x12\x1a\n\x12\x61\x63\x63\x65ss_permissions\x18\x06 \x03(\t\x12\x19\n\x11suggest_algorithm\x18\x07 \x01(\t\x12\x1a\n\x12\x61utostop_algorithm\x18\x08 \x01(\t\x12\x17\n\x0fstudy_task_name\x18\t \x01(\t\x12\x37\n\x15suggestion_parameters\x18\n \x03(\x0b\x32\x18.api.SuggestionParameter\x12\x16\n\x04tags\x18\x0b \x03(\x0b\x32\x08.api.Tag\x12\x1c\n\x14objective_value_name\x18\x0c \x01(\t\x12\x0f\n\x07metrics\x18\r \x03(\t\x12\r\n\x05image\x18\x0e \x01(\t\x12\x0f\n\x07\x63ommand\x18\x0f \x03(\t\x12\x0b\n\x03gpu\x18\x10 \x01(\x05\x12\x11\n\tscheduler\x18\x11 \x01(\t\x12\x1d\n\x05mount\x18\x12 \x01(\x0b\x32\x0e.api.MountConf\x12\x13\n\x0bpull_secret\x18\x13 \x01(\t\x1a\x39\n\x10ParameterConfigs\x12%\n\x07\x63onfigs\x18\x01 \x03(\x0b\x32\x14.api.ParameterConfig\"<\n\x12\x43reateStudyRequest\x12&\n\x0cstudy_config\x18\x01 \x01(\x0b\x32\x10.api.StudyConfig\"$\n\x10\x43reateStudyReply\x12\x10\n\x08study_id\x18\x01 \x01(\t\"$\n\x10StopStudyRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\"\x10\n\x0eStopStudyReply\"\x13\n\x11GetStudiesRequest\"r\n\tStudyInfo\x12\x10\n\x08study_id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\r\n\x05owner\x18\x03 \x01(\t\x12\x19\n\x11running_trial_num\x18\x04 \x01(\x05\x12\x1b\n\x13\x63ompleted_trial_num\x18\x05 \x01(\x05\"6\n\x0fGetStudiesReply\x12#\n\x0bstudy_infos\x18\x01 \x03(\x0b\x32\x0e.api.StudyInfo\"f\n\x14SuggestTrialsRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\x12\x19\n\x11suggest_algorithm\x18\x02 \x01(\t\x12!\n\x07\x63onfigs\x18\x03 \x01(\x0b\x32\x10.api.StudyConfig\"C\n\x12SuggestTrialsReply\x12\x1a\n\x06trials\x18\x01 \x03(\x0b\x32\n.api.Trial\x12\x11\n\tcompleted\x18\x02 \x01(\x08\">\n\x14\x43ompleteTrialRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\x12\x13\n\x0bis_complete\x18\x02 \x01(\x08\"\x14\n\x12\x43ompleteTrialReply\"F\n\x16ShouldTrialStopRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\x12\x1a\n\x12\x61utostop_algorithm\x18\x02 \x01(\t\"F\n\x14ShouldTrialStopReply\x12\x1a\n\x06trials\x18\x01 \x03(\x0b\x32\n.api.Trial\x12\x12\n\nworker_ids\x18\x02 \x03(\t\"*\n\x15GetObjectValueRequest\x12\x11\n\tworker_id\x18\x01 \x01(\t\"1\n\x13GetObjectValueReply\x12\x1a\n\x06trials\x18\x01 \x03(\x0b\x32\n.api.Trial\"B\n\x1d\x41\x64\x64MeasurementToTrialsRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\x12\x0f\n\x07metrics\x18\x02 \x01(\t\"\x1d\n\x1b\x41\x64\x64MeasurementToTrialsReply\"\xaa\x01\n\x1fInitializeSuggestServiceRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\x12\x19\n\x11suggest_algorithm\x18\x02 \x01(\t\x12\x37\n\x15suggestion_parameters\x18\x03 \x03(\x0b\x32\x18.api.SuggestionParameter\x12!\n\x07\x63onfigs\x18\x04 \x01(\x0b\x32\x10.api.StudyConfig\"\x1f\n\x1dInitializeSuggestServiceReply\"\x96\x01\n\x15GenerateTrialsRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\x12!\n\x07\x63onfigs\x18\x02 \x01(\x0b\x32\x10.api.StudyConfig\x12$\n\x10\x63ompleted_trials\x18\x03 \x03(\x0b\x32\n.api.Trial\x12\"\n\x0erunning_trials\x18\x04 \x03(\x0b\x32\n.api.Trial\"D\n\x13GenerateTrialsReply\x12\x1a\n\x06trials\x18\x01 \x03(\x0b\x32\n.api.Trial\x12\x11\n\tcompleted\x18\x02 \x01(\x08\"\x8e\x01\n\x1eSetSuggestionParametersRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\x12\x37\n\x15suggestion_parameters\x18\x02 \x03(\x0b\x32\x18.api.SuggestionParameter\x12!\n\x07\x63onfigs\x18\x03 \x01(\x0b\x32\x10.api.StudyConfig\"\x1e\n\x1cSetSuggestionParametersReply\")\n\x15StopSuggestionRequest\x12\x10\n\x08study_id\x18\x01 \x01(\t\"\x15\n\x13StopSuggestionReply*U\n\rParameterType\x12\x10\n\x0cUNKNOWN_TYPE\x10\x00\x12\n\n\x06\x44OUBLE\x10\x01\x12\x07\n\x03INT\x10\x02\x12\x0c\n\x08\x44ISCRETE\x10\x03\x12\x0f\n\x0b\x43\x41TEGORICAL\x10\x04*H\n\x10OptimizationType\x12\x18\n\x14UNKNOWN_OPTIMIZATION\x10\x00\x12\x0c\n\x08MINIMIZE\x10\x01\x12\x0c\n\x08MAXIMIZE\x10\x02*L\n\nTrialState\x12\x0b\n\x07PENDING\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tCOMPLETED\x10\x02\x12\n\n\x06KILLED\x10\x03\x12\t\n\x05\x45RROR\x10x2\xa0\x05\n\x07Manager\x12=\n\x0b\x43reateStudy\x12\x17.api.CreateStudyRequest\x1a\x15.api.CreateStudyReply\x12\x37\n\tStopStudy\x12\x15.api.StopStudyRequest\x1a\x13.api.StopStudyReply\x12:\n\nGetStudies\x12\x16.api.GetStudiesRequest\x1a\x14.api.GetStudiesReply\x12\x43\n\rSuggestTrials\x12\x19.api.SuggestTrialsRequest\x1a\x17.api.SuggestTrialsReply\x12\x43\n\rCompleteTrial\x12\x19.api.CompleteTrialRequest\x1a\x17.api.CompleteTrialReply\x12I\n\x0fShouldTrialStop\x12\x1b.api.ShouldTrialStopRequest\x1a\x19.api.ShouldTrialStopReply\x12\x46\n\x0eGetObjectValue\x12\x1a.api.GetObjectValueRequest\x1a\x18.api.GetObjectValueReply\x12^\n\x16\x41\x64\x64MeasurementToTrials\x12\".api.AddMeasurementToTrialsRequest\x1a .api.AddMeasurementToTrialsReply\x12\x64\n\x18InitializeSuggestService\x12$.api.InitializeSuggestServiceRequest\x1a\".api.InitializeSuggestServiceReply2\xff\x01\n\nSuggestion\x12\x46\n\x0eGenerateTrials\x12\x1a.api.GenerateTrialsRequest\x1a\x18.api.GenerateTrialsReply\x12\x61\n\x17SetSuggestionParameters\x12#.api.SetSuggestionParametersRequest\x1a!.api.SetSuggestionParametersReply\x12\x46\n\x0eStopSuggestion\x12\x1a.api.StopSuggestionRequest\x1a\x18.api.StopSuggestionReply2\x0e\n\x0c\x41utoStoppingb\x06proto3') +) + +_PARAMETERTYPE = _descriptor.EnumDescriptor( + name='ParameterType', + full_name='api.ParameterType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNKNOWN_TYPE', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DOUBLE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DISCRETE', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CATEGORICAL', index=4, number=4, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2925, + serialized_end=3010, +) +_sym_db.RegisterEnumDescriptor(_PARAMETERTYPE) + +ParameterType = enum_type_wrapper.EnumTypeWrapper(_PARAMETERTYPE) +_OPTIMIZATIONTYPE = _descriptor.EnumDescriptor( + name='OptimizationType', + full_name='api.OptimizationType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNKNOWN_OPTIMIZATION', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MINIMIZE', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='MAXIMIZE', index=2, number=2, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3012, + serialized_end=3084, +) +_sym_db.RegisterEnumDescriptor(_OPTIMIZATIONTYPE) + +OptimizationType = enum_type_wrapper.EnumTypeWrapper(_OPTIMIZATIONTYPE) +_TRIALSTATE = _descriptor.EnumDescriptor( + name='TrialState', + full_name='api.TrialState', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='PENDING', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RUNNING', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLETED', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='KILLED', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ERROR', index=4, number=120, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=3086, + serialized_end=3162, +) +_sym_db.RegisterEnumDescriptor(_TRIALSTATE) + +TrialState = enum_type_wrapper.EnumTypeWrapper(_TRIALSTATE) +UNKNOWN_TYPE = 0 +DOUBLE = 1 +INT = 2 +DISCRETE = 3 +CATEGORICAL = 4 +UNKNOWN_OPTIMIZATION = 0 +MINIMIZE = 1 +MAXIMIZE = 2 +PENDING = 0 +RUNNING = 1 +COMPLETED = 2 +KILLED = 3 +ERROR = 120 + + + +_FEASIBLESPACE = _descriptor.Descriptor( + name='FeasibleSpace', + full_name='api.FeasibleSpace', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='max', full_name='api.FeasibleSpace.max', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='min', full_name='api.FeasibleSpace.min', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='list', full_name='api.FeasibleSpace.list', index=2, + number=3, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=18, + serialized_end=73, +) + + +_PARAMETERCONFIG = _descriptor.Descriptor( + name='ParameterConfig', + full_name='api.ParameterConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='api.ParameterConfig.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter_type', full_name='api.ParameterConfig.parameter_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='feasible', full_name='api.ParameterConfig.feasible', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=75, + serialized_end=188, +) + + +_PARAMETER = _descriptor.Descriptor( + name='Parameter', + full_name='api.Parameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='api.Parameter.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter_type', full_name='api.Parameter.parameter_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='api.Parameter.value', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=190, + serialized_end=274, +) + + +_METRICS = _descriptor.Descriptor( + name='Metrics', + full_name='api.Metrics', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='api.Metrics.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='api.Metrics.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=276, + serialized_end=314, +) + + +_EVALUATIONLOG = _descriptor.Descriptor( + name='EvaluationLog', + full_name='api.EvaluationLog', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='time', full_name='api.EvaluationLog.time', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metrics', full_name='api.EvaluationLog.metrics', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=316, + serialized_end=376, +) + + +_SUGGESTIONPARAMETER = _descriptor.Descriptor( + name='SuggestionParameter', + full_name='api.SuggestionParameter', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='api.SuggestionParameter.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='api.SuggestionParameter.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=378, + serialized_end=428, +) + + +_TAG = _descriptor.Descriptor( + name='Tag', + full_name='api.Tag', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='api.Tag.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='api.Tag.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=430, + serialized_end=464, +) + + +_MOUNTCONF = _descriptor.Descriptor( + name='MountConf', + full_name='api.MountConf', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='pvc', full_name='api.MountConf.pvc', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='path', full_name='api.MountConf.path', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=466, + serialized_end=504, +) + + +_TRIAL = _descriptor.Descriptor( + name='Trial', + full_name='api.Trial', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='trial_id', full_name='api.Trial.trial_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='study_id', full_name='api.Trial.study_id', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter_set', full_name='api.Trial.parameter_set', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='status', full_name='api.Trial.status', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='eval_logs', full_name='api.Trial.eval_logs', index=4, + number=5, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='objective_value', full_name='api.Trial.objective_value', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tags', full_name='api.Trial.tags', index=6, + number=7, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=507, + serialized_end=710, +) + + +_STUDYCONFIG_PARAMETERCONFIGS = _descriptor.Descriptor( + name='ParameterConfigs', + full_name='api.StudyConfig.ParameterConfigs', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='configs', full_name='api.StudyConfig.ParameterConfigs.configs', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1248, + serialized_end=1305, +) + +_STUDYCONFIG = _descriptor.Descriptor( + name='StudyConfig', + full_name='api.StudyConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='api.StudyConfig.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='owner', full_name='api.StudyConfig.owner', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='optimization_type', full_name='api.StudyConfig.optimization_type', index=2, + number=3, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='optimization_goal', full_name='api.StudyConfig.optimization_goal', index=3, + number=4, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='parameter_configs', full_name='api.StudyConfig.parameter_configs', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='access_permissions', full_name='api.StudyConfig.access_permissions', index=5, + number=6, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='suggest_algorithm', full_name='api.StudyConfig.suggest_algorithm', index=6, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='autostop_algorithm', full_name='api.StudyConfig.autostop_algorithm', index=7, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='study_task_name', full_name='api.StudyConfig.study_task_name', index=8, + number=9, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='suggestion_parameters', full_name='api.StudyConfig.suggestion_parameters', index=9, + number=10, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tags', full_name='api.StudyConfig.tags', index=10, + number=11, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='objective_value_name', full_name='api.StudyConfig.objective_value_name', index=11, + number=12, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metrics', full_name='api.StudyConfig.metrics', index=12, + number=13, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='image', full_name='api.StudyConfig.image', index=13, + number=14, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='command', full_name='api.StudyConfig.command', index=14, + number=15, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='gpu', full_name='api.StudyConfig.gpu', index=15, + number=16, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='scheduler', full_name='api.StudyConfig.scheduler', index=16, + number=17, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='mount', full_name='api.StudyConfig.mount', index=17, + number=18, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='pull_secret', full_name='api.StudyConfig.pull_secret', index=18, + number=19, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_STUDYCONFIG_PARAMETERCONFIGS, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=713, + serialized_end=1305, +) + + +_CREATESTUDYREQUEST = _descriptor.Descriptor( + name='CreateStudyRequest', + full_name='api.CreateStudyRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_config', full_name='api.CreateStudyRequest.study_config', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1307, + serialized_end=1367, +) + + +_CREATESTUDYREPLY = _descriptor.Descriptor( + name='CreateStudyReply', + full_name='api.CreateStudyReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.CreateStudyReply.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1369, + serialized_end=1405, +) + + +_STOPSTUDYREQUEST = _descriptor.Descriptor( + name='StopStudyRequest', + full_name='api.StopStudyRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.StopStudyRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1407, + serialized_end=1443, +) + + +_STOPSTUDYREPLY = _descriptor.Descriptor( + name='StopStudyReply', + full_name='api.StopStudyReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1445, + serialized_end=1461, +) + + +_GETSTUDIESREQUEST = _descriptor.Descriptor( + name='GetStudiesRequest', + full_name='api.GetStudiesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1463, + serialized_end=1482, +) + + +_STUDYINFO = _descriptor.Descriptor( + name='StudyInfo', + full_name='api.StudyInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.StudyInfo.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='api.StudyInfo.name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='owner', full_name='api.StudyInfo.owner', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='running_trial_num', full_name='api.StudyInfo.running_trial_num', index=3, + number=4, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='completed_trial_num', full_name='api.StudyInfo.completed_trial_num', index=4, + number=5, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1484, + serialized_end=1598, +) + + +_GETSTUDIESREPLY = _descriptor.Descriptor( + name='GetStudiesReply', + full_name='api.GetStudiesReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_infos', full_name='api.GetStudiesReply.study_infos', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1600, + serialized_end=1654, +) + + +_SUGGESTTRIALSREQUEST = _descriptor.Descriptor( + name='SuggestTrialsRequest', + full_name='api.SuggestTrialsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.SuggestTrialsRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='suggest_algorithm', full_name='api.SuggestTrialsRequest.suggest_algorithm', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='configs', full_name='api.SuggestTrialsRequest.configs', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1656, + serialized_end=1758, +) + + +_SUGGESTTRIALSREPLY = _descriptor.Descriptor( + name='SuggestTrialsReply', + full_name='api.SuggestTrialsReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='trials', full_name='api.SuggestTrialsReply.trials', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='completed', full_name='api.SuggestTrialsReply.completed', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1760, + serialized_end=1827, +) + + +_COMPLETETRIALREQUEST = _descriptor.Descriptor( + name='CompleteTrialRequest', + full_name='api.CompleteTrialRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='worker_id', full_name='api.CompleteTrialRequest.worker_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='is_complete', full_name='api.CompleteTrialRequest.is_complete', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1829, + serialized_end=1891, +) + + +_COMPLETETRIALREPLY = _descriptor.Descriptor( + name='CompleteTrialReply', + full_name='api.CompleteTrialReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1893, + serialized_end=1913, +) + + +_SHOULDTRIALSTOPREQUEST = _descriptor.Descriptor( + name='ShouldTrialStopRequest', + full_name='api.ShouldTrialStopRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.ShouldTrialStopRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='autostop_algorithm', full_name='api.ShouldTrialStopRequest.autostop_algorithm', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1915, + serialized_end=1985, +) + + +_SHOULDTRIALSTOPREPLY = _descriptor.Descriptor( + name='ShouldTrialStopReply', + full_name='api.ShouldTrialStopReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='trials', full_name='api.ShouldTrialStopReply.trials', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='worker_ids', full_name='api.ShouldTrialStopReply.worker_ids', index=1, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1987, + serialized_end=2057, +) + + +_GETOBJECTVALUEREQUEST = _descriptor.Descriptor( + name='GetObjectValueRequest', + full_name='api.GetObjectValueRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='worker_id', full_name='api.GetObjectValueRequest.worker_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2059, + serialized_end=2101, +) + + +_GETOBJECTVALUEREPLY = _descriptor.Descriptor( + name='GetObjectValueReply', + full_name='api.GetObjectValueReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='trials', full_name='api.GetObjectValueReply.trials', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2103, + serialized_end=2152, +) + + +_ADDMEASUREMENTTOTRIALSREQUEST = _descriptor.Descriptor( + name='AddMeasurementToTrialsRequest', + full_name='api.AddMeasurementToTrialsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.AddMeasurementToTrialsRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metrics', full_name='api.AddMeasurementToTrialsRequest.metrics', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2154, + serialized_end=2220, +) + + +_ADDMEASUREMENTTOTRIALSREPLY = _descriptor.Descriptor( + name='AddMeasurementToTrialsReply', + full_name='api.AddMeasurementToTrialsReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2222, + serialized_end=2251, +) + + +_INITIALIZESUGGESTSERVICEREQUEST = _descriptor.Descriptor( + name='InitializeSuggestServiceRequest', + full_name='api.InitializeSuggestServiceRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.InitializeSuggestServiceRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='suggest_algorithm', full_name='api.InitializeSuggestServiceRequest.suggest_algorithm', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='suggestion_parameters', full_name='api.InitializeSuggestServiceRequest.suggestion_parameters', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='configs', full_name='api.InitializeSuggestServiceRequest.configs', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2254, + serialized_end=2424, +) + + +_INITIALIZESUGGESTSERVICEREPLY = _descriptor.Descriptor( + name='InitializeSuggestServiceReply', + full_name='api.InitializeSuggestServiceReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2426, + serialized_end=2457, +) + + +_GENERATETRIALSREQUEST = _descriptor.Descriptor( + name='GenerateTrialsRequest', + full_name='api.GenerateTrialsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.GenerateTrialsRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='configs', full_name='api.GenerateTrialsRequest.configs', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='completed_trials', full_name='api.GenerateTrialsRequest.completed_trials', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='running_trials', full_name='api.GenerateTrialsRequest.running_trials', index=3, + number=4, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2460, + serialized_end=2610, +) + + +_GENERATETRIALSREPLY = _descriptor.Descriptor( + name='GenerateTrialsReply', + full_name='api.GenerateTrialsReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='trials', full_name='api.GenerateTrialsReply.trials', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='completed', full_name='api.GenerateTrialsReply.completed', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2612, + serialized_end=2680, +) + + +_SETSUGGESTIONPARAMETERSREQUEST = _descriptor.Descriptor( + name='SetSuggestionParametersRequest', + full_name='api.SetSuggestionParametersRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.SetSuggestionParametersRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='suggestion_parameters', full_name='api.SetSuggestionParametersRequest.suggestion_parameters', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='configs', full_name='api.SetSuggestionParametersRequest.configs', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2683, + serialized_end=2825, +) + + +_SETSUGGESTIONPARAMETERSREPLY = _descriptor.Descriptor( + name='SetSuggestionParametersReply', + full_name='api.SetSuggestionParametersReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2827, + serialized_end=2857, +) + + +_STOPSUGGESTIONREQUEST = _descriptor.Descriptor( + name='StopSuggestionRequest', + full_name='api.StopSuggestionRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='study_id', full_name='api.StopSuggestionRequest.study_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2859, + serialized_end=2900, +) + + +_STOPSUGGESTIONREPLY = _descriptor.Descriptor( + name='StopSuggestionReply', + full_name='api.StopSuggestionReply', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2902, + serialized_end=2923, +) + +_PARAMETERCONFIG.fields_by_name['parameter_type'].enum_type = _PARAMETERTYPE +_PARAMETERCONFIG.fields_by_name['feasible'].message_type = _FEASIBLESPACE +_PARAMETER.fields_by_name['parameter_type'].enum_type = _PARAMETERTYPE +_EVALUATIONLOG.fields_by_name['metrics'].message_type = _METRICS +_TRIAL.fields_by_name['parameter_set'].message_type = _PARAMETER +_TRIAL.fields_by_name['status'].enum_type = _TRIALSTATE +_TRIAL.fields_by_name['eval_logs'].message_type = _EVALUATIONLOG +_TRIAL.fields_by_name['tags'].message_type = _TAG +_STUDYCONFIG_PARAMETERCONFIGS.fields_by_name['configs'].message_type = _PARAMETERCONFIG +_STUDYCONFIG_PARAMETERCONFIGS.containing_type = _STUDYCONFIG +_STUDYCONFIG.fields_by_name['optimization_type'].enum_type = _OPTIMIZATIONTYPE +_STUDYCONFIG.fields_by_name['parameter_configs'].message_type = _STUDYCONFIG_PARAMETERCONFIGS +_STUDYCONFIG.fields_by_name['suggestion_parameters'].message_type = _SUGGESTIONPARAMETER +_STUDYCONFIG.fields_by_name['tags'].message_type = _TAG +_STUDYCONFIG.fields_by_name['mount'].message_type = _MOUNTCONF +_CREATESTUDYREQUEST.fields_by_name['study_config'].message_type = _STUDYCONFIG +_GETSTUDIESREPLY.fields_by_name['study_infos'].message_type = _STUDYINFO +_SUGGESTTRIALSREQUEST.fields_by_name['configs'].message_type = _STUDYCONFIG +_SUGGESTTRIALSREPLY.fields_by_name['trials'].message_type = _TRIAL +_SHOULDTRIALSTOPREPLY.fields_by_name['trials'].message_type = _TRIAL +_GETOBJECTVALUEREPLY.fields_by_name['trials'].message_type = _TRIAL +_INITIALIZESUGGESTSERVICEREQUEST.fields_by_name['suggestion_parameters'].message_type = _SUGGESTIONPARAMETER +_INITIALIZESUGGESTSERVICEREQUEST.fields_by_name['configs'].message_type = _STUDYCONFIG +_GENERATETRIALSREQUEST.fields_by_name['configs'].message_type = _STUDYCONFIG +_GENERATETRIALSREQUEST.fields_by_name['completed_trials'].message_type = _TRIAL +_GENERATETRIALSREQUEST.fields_by_name['running_trials'].message_type = _TRIAL +_GENERATETRIALSREPLY.fields_by_name['trials'].message_type = _TRIAL +_SETSUGGESTIONPARAMETERSREQUEST.fields_by_name['suggestion_parameters'].message_type = _SUGGESTIONPARAMETER +_SETSUGGESTIONPARAMETERSREQUEST.fields_by_name['configs'].message_type = _STUDYCONFIG +DESCRIPTOR.message_types_by_name['FeasibleSpace'] = _FEASIBLESPACE +DESCRIPTOR.message_types_by_name['ParameterConfig'] = _PARAMETERCONFIG +DESCRIPTOR.message_types_by_name['Parameter'] = _PARAMETER +DESCRIPTOR.message_types_by_name['Metrics'] = _METRICS +DESCRIPTOR.message_types_by_name['EvaluationLog'] = _EVALUATIONLOG +DESCRIPTOR.message_types_by_name['SuggestionParameter'] = _SUGGESTIONPARAMETER +DESCRIPTOR.message_types_by_name['Tag'] = _TAG +DESCRIPTOR.message_types_by_name['MountConf'] = _MOUNTCONF +DESCRIPTOR.message_types_by_name['Trial'] = _TRIAL +DESCRIPTOR.message_types_by_name['StudyConfig'] = _STUDYCONFIG +DESCRIPTOR.message_types_by_name['CreateStudyRequest'] = _CREATESTUDYREQUEST +DESCRIPTOR.message_types_by_name['CreateStudyReply'] = _CREATESTUDYREPLY +DESCRIPTOR.message_types_by_name['StopStudyRequest'] = _STOPSTUDYREQUEST +DESCRIPTOR.message_types_by_name['StopStudyReply'] = _STOPSTUDYREPLY +DESCRIPTOR.message_types_by_name['GetStudiesRequest'] = _GETSTUDIESREQUEST +DESCRIPTOR.message_types_by_name['StudyInfo'] = _STUDYINFO +DESCRIPTOR.message_types_by_name['GetStudiesReply'] = _GETSTUDIESREPLY +DESCRIPTOR.message_types_by_name['SuggestTrialsRequest'] = _SUGGESTTRIALSREQUEST +DESCRIPTOR.message_types_by_name['SuggestTrialsReply'] = _SUGGESTTRIALSREPLY +DESCRIPTOR.message_types_by_name['CompleteTrialRequest'] = _COMPLETETRIALREQUEST +DESCRIPTOR.message_types_by_name['CompleteTrialReply'] = _COMPLETETRIALREPLY +DESCRIPTOR.message_types_by_name['ShouldTrialStopRequest'] = _SHOULDTRIALSTOPREQUEST +DESCRIPTOR.message_types_by_name['ShouldTrialStopReply'] = _SHOULDTRIALSTOPREPLY +DESCRIPTOR.message_types_by_name['GetObjectValueRequest'] = _GETOBJECTVALUEREQUEST +DESCRIPTOR.message_types_by_name['GetObjectValueReply'] = _GETOBJECTVALUEREPLY +DESCRIPTOR.message_types_by_name['AddMeasurementToTrialsRequest'] = _ADDMEASUREMENTTOTRIALSREQUEST +DESCRIPTOR.message_types_by_name['AddMeasurementToTrialsReply'] = _ADDMEASUREMENTTOTRIALSREPLY +DESCRIPTOR.message_types_by_name['InitializeSuggestServiceRequest'] = _INITIALIZESUGGESTSERVICEREQUEST +DESCRIPTOR.message_types_by_name['InitializeSuggestServiceReply'] = _INITIALIZESUGGESTSERVICEREPLY +DESCRIPTOR.message_types_by_name['GenerateTrialsRequest'] = _GENERATETRIALSREQUEST +DESCRIPTOR.message_types_by_name['GenerateTrialsReply'] = _GENERATETRIALSREPLY +DESCRIPTOR.message_types_by_name['SetSuggestionParametersRequest'] = _SETSUGGESTIONPARAMETERSREQUEST +DESCRIPTOR.message_types_by_name['SetSuggestionParametersReply'] = _SETSUGGESTIONPARAMETERSREPLY +DESCRIPTOR.message_types_by_name['StopSuggestionRequest'] = _STOPSUGGESTIONREQUEST +DESCRIPTOR.message_types_by_name['StopSuggestionReply'] = _STOPSUGGESTIONREPLY +DESCRIPTOR.enum_types_by_name['ParameterType'] = _PARAMETERTYPE +DESCRIPTOR.enum_types_by_name['OptimizationType'] = _OPTIMIZATIONTYPE +DESCRIPTOR.enum_types_by_name['TrialState'] = _TRIALSTATE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +FeasibleSpace = _reflection.GeneratedProtocolMessageType('FeasibleSpace', (_message.Message,), dict( + DESCRIPTOR = _FEASIBLESPACE, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.FeasibleSpace) + )) +_sym_db.RegisterMessage(FeasibleSpace) + +ParameterConfig = _reflection.GeneratedProtocolMessageType('ParameterConfig', (_message.Message,), dict( + DESCRIPTOR = _PARAMETERCONFIG, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.ParameterConfig) + )) +_sym_db.RegisterMessage(ParameterConfig) + +Parameter = _reflection.GeneratedProtocolMessageType('Parameter', (_message.Message,), dict( + DESCRIPTOR = _PARAMETER, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.Parameter) + )) +_sym_db.RegisterMessage(Parameter) + +Metrics = _reflection.GeneratedProtocolMessageType('Metrics', (_message.Message,), dict( + DESCRIPTOR = _METRICS, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.Metrics) + )) +_sym_db.RegisterMessage(Metrics) + +EvaluationLog = _reflection.GeneratedProtocolMessageType('EvaluationLog', (_message.Message,), dict( + DESCRIPTOR = _EVALUATIONLOG, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.EvaluationLog) + )) +_sym_db.RegisterMessage(EvaluationLog) + +SuggestionParameter = _reflection.GeneratedProtocolMessageType('SuggestionParameter', (_message.Message,), dict( + DESCRIPTOR = _SUGGESTIONPARAMETER, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.SuggestionParameter) + )) +_sym_db.RegisterMessage(SuggestionParameter) + +Tag = _reflection.GeneratedProtocolMessageType('Tag', (_message.Message,), dict( + DESCRIPTOR = _TAG, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.Tag) + )) +_sym_db.RegisterMessage(Tag) + +MountConf = _reflection.GeneratedProtocolMessageType('MountConf', (_message.Message,), dict( + DESCRIPTOR = _MOUNTCONF, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.MountConf) + )) +_sym_db.RegisterMessage(MountConf) + +Trial = _reflection.GeneratedProtocolMessageType('Trial', (_message.Message,), dict( + DESCRIPTOR = _TRIAL, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.Trial) + )) +_sym_db.RegisterMessage(Trial) + +StudyConfig = _reflection.GeneratedProtocolMessageType('StudyConfig', (_message.Message,), dict( + + ParameterConfigs = _reflection.GeneratedProtocolMessageType('ParameterConfigs', (_message.Message,), dict( + DESCRIPTOR = _STUDYCONFIG_PARAMETERCONFIGS, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.StudyConfig.ParameterConfigs) + )) + , + DESCRIPTOR = _STUDYCONFIG, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.StudyConfig) + )) +_sym_db.RegisterMessage(StudyConfig) +_sym_db.RegisterMessage(StudyConfig.ParameterConfigs) + +CreateStudyRequest = _reflection.GeneratedProtocolMessageType('CreateStudyRequest', (_message.Message,), dict( + DESCRIPTOR = _CREATESTUDYREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.CreateStudyRequest) + )) +_sym_db.RegisterMessage(CreateStudyRequest) + +CreateStudyReply = _reflection.GeneratedProtocolMessageType('CreateStudyReply', (_message.Message,), dict( + DESCRIPTOR = _CREATESTUDYREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.CreateStudyReply) + )) +_sym_db.RegisterMessage(CreateStudyReply) + +StopStudyRequest = _reflection.GeneratedProtocolMessageType('StopStudyRequest', (_message.Message,), dict( + DESCRIPTOR = _STOPSTUDYREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.StopStudyRequest) + )) +_sym_db.RegisterMessage(StopStudyRequest) + +StopStudyReply = _reflection.GeneratedProtocolMessageType('StopStudyReply', (_message.Message,), dict( + DESCRIPTOR = _STOPSTUDYREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.StopStudyReply) + )) +_sym_db.RegisterMessage(StopStudyReply) + +GetStudiesRequest = _reflection.GeneratedProtocolMessageType('GetStudiesRequest', (_message.Message,), dict( + DESCRIPTOR = _GETSTUDIESREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.GetStudiesRequest) + )) +_sym_db.RegisterMessage(GetStudiesRequest) + +StudyInfo = _reflection.GeneratedProtocolMessageType('StudyInfo', (_message.Message,), dict( + DESCRIPTOR = _STUDYINFO, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.StudyInfo) + )) +_sym_db.RegisterMessage(StudyInfo) + +GetStudiesReply = _reflection.GeneratedProtocolMessageType('GetStudiesReply', (_message.Message,), dict( + DESCRIPTOR = _GETSTUDIESREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.GetStudiesReply) + )) +_sym_db.RegisterMessage(GetStudiesReply) + +SuggestTrialsRequest = _reflection.GeneratedProtocolMessageType('SuggestTrialsRequest', (_message.Message,), dict( + DESCRIPTOR = _SUGGESTTRIALSREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.SuggestTrialsRequest) + )) +_sym_db.RegisterMessage(SuggestTrialsRequest) + +SuggestTrialsReply = _reflection.GeneratedProtocolMessageType('SuggestTrialsReply', (_message.Message,), dict( + DESCRIPTOR = _SUGGESTTRIALSREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.SuggestTrialsReply) + )) +_sym_db.RegisterMessage(SuggestTrialsReply) + +CompleteTrialRequest = _reflection.GeneratedProtocolMessageType('CompleteTrialRequest', (_message.Message,), dict( + DESCRIPTOR = _COMPLETETRIALREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.CompleteTrialRequest) + )) +_sym_db.RegisterMessage(CompleteTrialRequest) + +CompleteTrialReply = _reflection.GeneratedProtocolMessageType('CompleteTrialReply', (_message.Message,), dict( + DESCRIPTOR = _COMPLETETRIALREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.CompleteTrialReply) + )) +_sym_db.RegisterMessage(CompleteTrialReply) + +ShouldTrialStopRequest = _reflection.GeneratedProtocolMessageType('ShouldTrialStopRequest', (_message.Message,), dict( + DESCRIPTOR = _SHOULDTRIALSTOPREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.ShouldTrialStopRequest) + )) +_sym_db.RegisterMessage(ShouldTrialStopRequest) + +ShouldTrialStopReply = _reflection.GeneratedProtocolMessageType('ShouldTrialStopReply', (_message.Message,), dict( + DESCRIPTOR = _SHOULDTRIALSTOPREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.ShouldTrialStopReply) + )) +_sym_db.RegisterMessage(ShouldTrialStopReply) + +GetObjectValueRequest = _reflection.GeneratedProtocolMessageType('GetObjectValueRequest', (_message.Message,), dict( + DESCRIPTOR = _GETOBJECTVALUEREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.GetObjectValueRequest) + )) +_sym_db.RegisterMessage(GetObjectValueRequest) + +GetObjectValueReply = _reflection.GeneratedProtocolMessageType('GetObjectValueReply', (_message.Message,), dict( + DESCRIPTOR = _GETOBJECTVALUEREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.GetObjectValueReply) + )) +_sym_db.RegisterMessage(GetObjectValueReply) + +AddMeasurementToTrialsRequest = _reflection.GeneratedProtocolMessageType('AddMeasurementToTrialsRequest', (_message.Message,), dict( + DESCRIPTOR = _ADDMEASUREMENTTOTRIALSREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.AddMeasurementToTrialsRequest) + )) +_sym_db.RegisterMessage(AddMeasurementToTrialsRequest) + +AddMeasurementToTrialsReply = _reflection.GeneratedProtocolMessageType('AddMeasurementToTrialsReply', (_message.Message,), dict( + DESCRIPTOR = _ADDMEASUREMENTTOTRIALSREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.AddMeasurementToTrialsReply) + )) +_sym_db.RegisterMessage(AddMeasurementToTrialsReply) + +InitializeSuggestServiceRequest = _reflection.GeneratedProtocolMessageType('InitializeSuggestServiceRequest', (_message.Message,), dict( + DESCRIPTOR = _INITIALIZESUGGESTSERVICEREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.InitializeSuggestServiceRequest) + )) +_sym_db.RegisterMessage(InitializeSuggestServiceRequest) + +InitializeSuggestServiceReply = _reflection.GeneratedProtocolMessageType('InitializeSuggestServiceReply', (_message.Message,), dict( + DESCRIPTOR = _INITIALIZESUGGESTSERVICEREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.InitializeSuggestServiceReply) + )) +_sym_db.RegisterMessage(InitializeSuggestServiceReply) + +GenerateTrialsRequest = _reflection.GeneratedProtocolMessageType('GenerateTrialsRequest', (_message.Message,), dict( + DESCRIPTOR = _GENERATETRIALSREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.GenerateTrialsRequest) + )) +_sym_db.RegisterMessage(GenerateTrialsRequest) + +GenerateTrialsReply = _reflection.GeneratedProtocolMessageType('GenerateTrialsReply', (_message.Message,), dict( + DESCRIPTOR = _GENERATETRIALSREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.GenerateTrialsReply) + )) +_sym_db.RegisterMessage(GenerateTrialsReply) + +SetSuggestionParametersRequest = _reflection.GeneratedProtocolMessageType('SetSuggestionParametersRequest', (_message.Message,), dict( + DESCRIPTOR = _SETSUGGESTIONPARAMETERSREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.SetSuggestionParametersRequest) + )) +_sym_db.RegisterMessage(SetSuggestionParametersRequest) + +SetSuggestionParametersReply = _reflection.GeneratedProtocolMessageType('SetSuggestionParametersReply', (_message.Message,), dict( + DESCRIPTOR = _SETSUGGESTIONPARAMETERSREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.SetSuggestionParametersReply) + )) +_sym_db.RegisterMessage(SetSuggestionParametersReply) + +StopSuggestionRequest = _reflection.GeneratedProtocolMessageType('StopSuggestionRequest', (_message.Message,), dict( + DESCRIPTOR = _STOPSUGGESTIONREQUEST, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.StopSuggestionRequest) + )) +_sym_db.RegisterMessage(StopSuggestionRequest) + +StopSuggestionReply = _reflection.GeneratedProtocolMessageType('StopSuggestionReply', (_message.Message,), dict( + DESCRIPTOR = _STOPSUGGESTIONREPLY, + __module__ = 'api_pb2' + # @@protoc_insertion_point(class_scope:api.StopSuggestionReply) + )) +_sym_db.RegisterMessage(StopSuggestionReply) + + + +_MANAGER = _descriptor.ServiceDescriptor( + name='Manager', + full_name='api.Manager', + file=DESCRIPTOR, + index=0, + options=None, + serialized_start=3165, + serialized_end=3837, + methods=[ + _descriptor.MethodDescriptor( + name='CreateStudy', + full_name='api.Manager.CreateStudy', + index=0, + containing_service=None, + input_type=_CREATESTUDYREQUEST, + output_type=_CREATESTUDYREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='StopStudy', + full_name='api.Manager.StopStudy', + index=1, + containing_service=None, + input_type=_STOPSTUDYREQUEST, + output_type=_STOPSTUDYREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='GetStudies', + full_name='api.Manager.GetStudies', + index=2, + containing_service=None, + input_type=_GETSTUDIESREQUEST, + output_type=_GETSTUDIESREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='SuggestTrials', + full_name='api.Manager.SuggestTrials', + index=3, + containing_service=None, + input_type=_SUGGESTTRIALSREQUEST, + output_type=_SUGGESTTRIALSREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='CompleteTrial', + full_name='api.Manager.CompleteTrial', + index=4, + containing_service=None, + input_type=_COMPLETETRIALREQUEST, + output_type=_COMPLETETRIALREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='ShouldTrialStop', + full_name='api.Manager.ShouldTrialStop', + index=5, + containing_service=None, + input_type=_SHOULDTRIALSTOPREQUEST, + output_type=_SHOULDTRIALSTOPREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='GetObjectValue', + full_name='api.Manager.GetObjectValue', + index=6, + containing_service=None, + input_type=_GETOBJECTVALUEREQUEST, + output_type=_GETOBJECTVALUEREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='AddMeasurementToTrials', + full_name='api.Manager.AddMeasurementToTrials', + index=7, + containing_service=None, + input_type=_ADDMEASUREMENTTOTRIALSREQUEST, + output_type=_ADDMEASUREMENTTOTRIALSREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='InitializeSuggestService', + full_name='api.Manager.InitializeSuggestService', + index=8, + containing_service=None, + input_type=_INITIALIZESUGGESTSERVICEREQUEST, + output_type=_INITIALIZESUGGESTSERVICEREPLY, + options=None, + ), +]) +_sym_db.RegisterServiceDescriptor(_MANAGER) + +DESCRIPTOR.services_by_name['Manager'] = _MANAGER + + +_SUGGESTION = _descriptor.ServiceDescriptor( + name='Suggestion', + full_name='api.Suggestion', + file=DESCRIPTOR, + index=1, + options=None, + serialized_start=3840, + serialized_end=4095, + methods=[ + _descriptor.MethodDescriptor( + name='GenerateTrials', + full_name='api.Suggestion.GenerateTrials', + index=0, + containing_service=None, + input_type=_GENERATETRIALSREQUEST, + output_type=_GENERATETRIALSREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='SetSuggestionParameters', + full_name='api.Suggestion.SetSuggestionParameters', + index=1, + containing_service=None, + input_type=_SETSUGGESTIONPARAMETERSREQUEST, + output_type=_SETSUGGESTIONPARAMETERSREPLY, + options=None, + ), + _descriptor.MethodDescriptor( + name='StopSuggestion', + full_name='api.Suggestion.StopSuggestion', + index=2, + containing_service=None, + input_type=_STOPSUGGESTIONREQUEST, + output_type=_STOPSUGGESTIONREPLY, + options=None, + ), +]) +_sym_db.RegisterServiceDescriptor(_SUGGESTION) + +DESCRIPTOR.services_by_name['Suggestion'] = _SUGGESTION + + +_AUTOSTOPPING = _descriptor.ServiceDescriptor( + name='AutoStopping', + full_name='api.AutoStopping', + file=DESCRIPTOR, + index=2, + options=None, + serialized_start=4097, + serialized_end=4111, + methods=[ +]) +_sym_db.RegisterServiceDescriptor(_AUTOSTOPPING) + +DESCRIPTOR.services_by_name['AutoStopping'] = _AUTOSTOPPING + +# @@protoc_insertion_point(module_scope) diff --git a/api/python/api_pb2_grpc.py b/api/python/api_pb2_grpc.py new file mode 100644 index 00000000000..65bbea04c79 --- /dev/null +++ b/api/python/api_pb2_grpc.py @@ -0,0 +1,283 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +import api.python.api_pb2 as api__pb2 + + +class ManagerStub(object): + # missing associated documentation comment in .proto file + pass + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.CreateStudy = channel.unary_unary( + '/api.Manager/CreateStudy', + request_serializer=api__pb2.CreateStudyRequest.SerializeToString, + response_deserializer=api__pb2.CreateStudyReply.FromString, + ) + self.StopStudy = channel.unary_unary( + '/api.Manager/StopStudy', + request_serializer=api__pb2.StopStudyRequest.SerializeToString, + response_deserializer=api__pb2.StopStudyReply.FromString, + ) + self.GetStudies = channel.unary_unary( + '/api.Manager/GetStudies', + request_serializer=api__pb2.GetStudiesRequest.SerializeToString, + response_deserializer=api__pb2.GetStudiesReply.FromString, + ) + self.SuggestTrials = channel.unary_unary( + '/api.Manager/SuggestTrials', + request_serializer=api__pb2.SuggestTrialsRequest.SerializeToString, + response_deserializer=api__pb2.SuggestTrialsReply.FromString, + ) + self.CompleteTrial = channel.unary_unary( + '/api.Manager/CompleteTrial', + request_serializer=api__pb2.CompleteTrialRequest.SerializeToString, + response_deserializer=api__pb2.CompleteTrialReply.FromString, + ) + self.ShouldTrialStop = channel.unary_unary( + '/api.Manager/ShouldTrialStop', + request_serializer=api__pb2.ShouldTrialStopRequest.SerializeToString, + response_deserializer=api__pb2.ShouldTrialStopReply.FromString, + ) + self.GetObjectValue = channel.unary_unary( + '/api.Manager/GetObjectValue', + request_serializer=api__pb2.GetObjectValueRequest.SerializeToString, + response_deserializer=api__pb2.GetObjectValueReply.FromString, + ) + self.AddMeasurementToTrials = channel.unary_unary( + '/api.Manager/AddMeasurementToTrials', + request_serializer=api__pb2.AddMeasurementToTrialsRequest.SerializeToString, + response_deserializer=api__pb2.AddMeasurementToTrialsReply.FromString, + ) + self.InitializeSuggestService = channel.unary_unary( + '/api.Manager/InitializeSuggestService', + request_serializer=api__pb2.InitializeSuggestServiceRequest.SerializeToString, + response_deserializer=api__pb2.InitializeSuggestServiceReply.FromString, + ) + + +class ManagerServicer(object): + # missing associated documentation comment in .proto file + pass + + def CreateStudy(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def StopStudy(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetStudies(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SuggestTrials(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def CompleteTrial(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ShouldTrialStop(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetObjectValue(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AddMeasurementToTrials(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def InitializeSuggestService(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ManagerServicer_to_server(servicer, server): + rpc_method_handlers = { + 'CreateStudy': grpc.unary_unary_rpc_method_handler( + servicer.CreateStudy, + request_deserializer=api__pb2.CreateStudyRequest.FromString, + response_serializer=api__pb2.CreateStudyReply.SerializeToString, + ), + 'StopStudy': grpc.unary_unary_rpc_method_handler( + servicer.StopStudy, + request_deserializer=api__pb2.StopStudyRequest.FromString, + response_serializer=api__pb2.StopStudyReply.SerializeToString, + ), + 'GetStudies': grpc.unary_unary_rpc_method_handler( + servicer.GetStudies, + request_deserializer=api__pb2.GetStudiesRequest.FromString, + response_serializer=api__pb2.GetStudiesReply.SerializeToString, + ), + 'SuggestTrials': grpc.unary_unary_rpc_method_handler( + servicer.SuggestTrials, + request_deserializer=api__pb2.SuggestTrialsRequest.FromString, + response_serializer=api__pb2.SuggestTrialsReply.SerializeToString, + ), + 'CompleteTrial': grpc.unary_unary_rpc_method_handler( + servicer.CompleteTrial, + request_deserializer=api__pb2.CompleteTrialRequest.FromString, + response_serializer=api__pb2.CompleteTrialReply.SerializeToString, + ), + 'ShouldTrialStop': grpc.unary_unary_rpc_method_handler( + servicer.ShouldTrialStop, + request_deserializer=api__pb2.ShouldTrialStopRequest.FromString, + response_serializer=api__pb2.ShouldTrialStopReply.SerializeToString, + ), + 'GetObjectValue': grpc.unary_unary_rpc_method_handler( + servicer.GetObjectValue, + request_deserializer=api__pb2.GetObjectValueRequest.FromString, + response_serializer=api__pb2.GetObjectValueReply.SerializeToString, + ), + 'AddMeasurementToTrials': grpc.unary_unary_rpc_method_handler( + servicer.AddMeasurementToTrials, + request_deserializer=api__pb2.AddMeasurementToTrialsRequest.FromString, + response_serializer=api__pb2.AddMeasurementToTrialsReply.SerializeToString, + ), + 'InitializeSuggestService': grpc.unary_unary_rpc_method_handler( + servicer.InitializeSuggestService, + request_deserializer=api__pb2.InitializeSuggestServiceRequest.FromString, + response_serializer=api__pb2.InitializeSuggestServiceReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'api.Manager', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + +class SuggestionStub(object): + # missing associated documentation comment in .proto file + pass + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GenerateTrials = channel.unary_unary( + '/api.Suggestion/GenerateTrials', + request_serializer=api__pb2.GenerateTrialsRequest.SerializeToString, + response_deserializer=api__pb2.GenerateTrialsReply.FromString, + ) + self.SetSuggestionParameters = channel.unary_unary( + '/api.Suggestion/SetSuggestionParameters', + request_serializer=api__pb2.SetSuggestionParametersRequest.SerializeToString, + response_deserializer=api__pb2.SetSuggestionParametersReply.FromString, + ) + self.StopSuggestion = channel.unary_unary( + '/api.Suggestion/StopSuggestion', + request_serializer=api__pb2.StopSuggestionRequest.SerializeToString, + response_deserializer=api__pb2.StopSuggestionReply.FromString, + ) + + +class SuggestionServicer(object): + # missing associated documentation comment in .proto file + pass + + def GenerateTrials(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetSuggestionParameters(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def StopSuggestion(self, request, context): + # missing associated documentation comment in .proto file + pass + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SuggestionServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GenerateTrials': grpc.unary_unary_rpc_method_handler( + servicer.GenerateTrials, + request_deserializer=api__pb2.GenerateTrialsRequest.FromString, + response_serializer=api__pb2.GenerateTrialsReply.SerializeToString, + ), + 'SetSuggestionParameters': grpc.unary_unary_rpc_method_handler( + servicer.SetSuggestionParameters, + request_deserializer=api__pb2.SetSuggestionParametersRequest.FromString, + response_serializer=api__pb2.SetSuggestionParametersReply.SerializeToString, + ), + 'StopSuggestion': grpc.unary_unary_rpc_method_handler( + servicer.StopSuggestion, + request_deserializer=api__pb2.StopSuggestionRequest.FromString, + response_serializer=api__pb2.StopSuggestionReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'api.Suggestion', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + +class AutoStoppingStub(object): + # missing associated documentation comment in .proto file + pass + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + + +class AutoStoppingServicer(object): + # missing associated documentation comment in .proto file + pass + + +def add_AutoStoppingServicer_to_server(servicer, server): + rpc_method_handlers = { + } + generic_handler = grpc.method_handlers_generic_handler( + 'api.AutoStopping', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/manifests/vizier/suggestion/bayesianoptimization/deployment.yaml b/manifests/vizier/suggestion/bayesianoptimization/deployment.yaml new file mode 100644 index 00000000000..58d079bed38 --- /dev/null +++ b/manifests/vizier/suggestion/bayesianoptimization/deployment.yaml @@ -0,0 +1,23 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: vizier-suggestion-bayesianoptimization + namespace: katib + labels: + app: vizier + component: suggestion-bayesianoptimization +spec: + replicas: 1 + template: + metadata: + name: vizier-suggestion-bayesianoptimization + labels: + app: vizier + component: suggestion-bayesianoptimization + spec: + containers: + - name: vizier-suggestion-bayesianoptimization + image: katib/suggestion-bayesianoptimization + ports: + - name: api + containerPort: 6789 \ No newline at end of file diff --git a/manifests/vizier/suggestion/bayesianoptimization/service.yaml b/manifests/vizier/suggestion/bayesianoptimization/service.yaml new file mode 100644 index 00000000000..9391ee69f1f --- /dev/null +++ b/manifests/vizier/suggestion/bayesianoptimization/service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: vizier-suggestion-bayesianoptimization + namespace: katib + labels: + app: vizier + component: suggestion-bayesianoptimization +spec: + type: ClusterIP + ports: + - port: 6789 + protocol: TCP + name: api + selector: + app: vizier + component: suggestion-bayesianoptimization \ No newline at end of file diff --git a/suggestion/bayesian_service.py b/suggestion/bayesian_service.py new file mode 100644 index 00000000000..e2b235b75ba --- /dev/null +++ b/suggestion/bayesian_service.py @@ -0,0 +1,144 @@ +import random +import string + +import grpc +import numpy as np + +from api.python import api_pb2 +from api.python import api_pb2_grpc +from suggestion.bayesianoptimization.src.bayesian_optimization_algorithm import BOAlgorithm +from suggestion.bayesianoptimization.src.algorithm_manager import AlgorithmManager + + +class BayesianService(api_pb2_grpc.SuggestionServicer): + def __init__(self): + # { + # study_id:[ + # { + # trial_id: + # metric: + # parameters: [] + # } + # ] + # } + self.trial_hist = {} + # { + # study_id:{ + # N: + # } + # } + self.service_params = {} + + def GenerateTrials(self, request, context): + if request.study_id not in self.trial_hist.keys(): + self.trial_hist[request.study_id] = [] + X_train = [] + y_train = [] + + for x in request.completed_trials: + for trial in self.trial_hist[x.study_id]: + if trial["trial_id"] == x.trial_id: + trial["metric"] = x.objective_value + + for x in self.trial_hist[request.study_id]: + if x["metric"] is not None: + X_train.append(x["parameters"]) + y_train.append(x["metric"]) + + algo_manager = AlgorithmManager( + study_id=request.study_id, + study_config=request.configs, + X_train=X_train, + y_train=y_train, + ) + + lowerbound = np.array(algo_manager.lower_bound) + upperbound = np.array(algo_manager.upper_bound) + # print("lowerbound", lowerbound) + # print("upperbound", upperbound) + alg = BOAlgorithm( + dim=algo_manager.dim, + N=int(self.service_params[request.study_id]["N"]), + lowerbound=lowerbound, + upperbound=upperbound, + X_train=algo_manager.X_train, + y_train=algo_manager.y_train, + mode=self.service_params[request.study_id]["mode"], + trade_off=self.service_params[request.study_id]["trade_off"], + # todo: support length_scale with array type + length_scale=self.service_params[request.study_id]["length_scale"], + noise=self.service_params[request.study_id]["noise"], + nu=self.service_params[request.study_id]["nu"], + kernel_type=self.service_params[request.study_id]["kernel_type"] + ) + x_next = alg.get_suggestion().squeeze() + + # todo: maybe there is a better way to generate a trial_id + trial_id = ''.join(random.sample(string.ascii_letters + string.digits, 12)) + self.trial_hist[request.study_id].append(dict({ + "trial_id": trial_id, + "parameters": x_next, + "metric": None, + })) + # print(x_next) + + x_next = algo_manager.parse_x_next(x_next) + x_next = algo_manager.convert_to_dict(x_next) + trial = api_pb2.Trial( + trial_id=trial_id, + study_id=request.study_id, + parameter_set=[ + api_pb2.Parameter( + name=x["name"], + value=str(x["value"]), + parameter_type=x["type"], + ) for x in x_next + ], + status=api_pb2.PENDING, + eval_logs=[], + ) + # print(self.trial_hist) + + return api_pb2.GenerateTrialsReply( + trials=[trial], + completed=False, + ) + + def SetSuggestionParameters(self, request, context): + if request.study_id not in self.service_params.keys(): + self.service_params[request.study_id] = { + "N": None, + "length_scale": None, + "noise": None, + "nu": None, + "kernel_type": None, + "mode": None, + "trade_off": None + } + for param in request.suggestion_parameters: + if param.name not in self.service_params[request.study_id].keys(): + context.set_code(grpc.StatusCode.UNKNOWN) + context.set_details("unknown suggestion parameter: "+param.name) + return api_pb2.SetSuggestionParametersReply() + if param.name == "length_scale" or param.name == "noise" or param.name == "nu" or param.name == "trade_off": + self.service_params[request.study_id][param.name] = float(param.value) + elif param.name == "N": + self.service_params[request.study_id][param.name] = int(param.value) + elif param.name == "kernel_type": + if param.value != "rbf" and param.value != "matern": + context.set_code(grpc.StatusCode.UNKNOWN) + context.set_details("unknown kernel type: " + param.value) + self.service_params[request.study_id][param.name] = param.value + elif param.name == "mode": + if param.value != "lcb" and param.value != "ei" and param.value != "pi": + context.set_code(grpc.StatusCode.UNKNOWN) + context.set_details("unknown acquisition mode: " + param.name) + self.service_params[request.study_id][param.name] = param.value + + return api_pb2.SetSuggestionParametersReply() + + def StopSuggestion(self, request, context): + if request.study_id in self.service_params.keys(): + del self.service_params[request.study_id] + del self.trial_hist[request.study_id] + return api_pb2.StopStudyReply() diff --git a/suggestion/bayesianoptimization/Dockerfile b/suggestion/bayesianoptimization/Dockerfile new file mode 100644 index 00000000000..5aaf9637ab8 --- /dev/null +++ b/suggestion/bayesianoptimization/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3 + +ADD . /usr/src/app/github.com/kubeflow/hp-tuning +WORKDIR /usr/src/app/github.com/kubeflow/hp-tuning/suggestion/bayesianoptimization +RUN pip install --no-cache-dir -r requirements.txt +ENV PYTHONPATH /usr/src/app/github.com/kubeflow/hp-tuning + +ENTRYPOINT ["python", "main.py"] \ No newline at end of file diff --git a/suggestion/bayesianoptimization/README.md b/suggestion/bayesianoptimization/README.md new file mode 100644 index 00000000000..72fe8c4a129 --- /dev/null +++ b/suggestion/bayesianoptimization/README.md @@ -0,0 +1,14 @@ +- start the service + +``` +python suggestion/bayesian/main.py +``` + +- start the testing client + +``` +python suggestion/test_client.py +``` + +note: +the testing client uses the [Franke's function](http://www.sfu.ca/~ssurjano/franke2d.html) as the black box, and the maximum of Franke's function is around 1.22 \ No newline at end of file diff --git a/suggestion/bayesianoptimization/__init__.py b/suggestion/bayesianoptimization/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/suggestion/bayesianoptimization/main.py b/suggestion/bayesianoptimization/main.py new file mode 100644 index 00000000000..79d666d5a03 --- /dev/null +++ b/suggestion/bayesianoptimization/main.py @@ -0,0 +1,25 @@ +import grpc +from concurrent import futures + +import time + +from api.python import api_pb2_grpc +from suggestion.bayesian_service import BayesianService +from suggestion.types import DEFAULT_PORT + +_ONE_DAY_IN_SECONDS = 60 * 60 * 24 + + +def serve(): + server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) + api_pb2_grpc.add_SuggestionServicer_to_server(BayesianService(), server) + server.add_insecure_port(DEFAULT_PORT) + server.start() + try: + while True: + time.sleep(_ONE_DAY_IN_SECONDS) + except KeyboardInterrupt: + server.stop(0) + +if __name__ == "__main__": + serve() diff --git a/suggestion/bayesianoptimization/requirements.txt b/suggestion/bayesianoptimization/requirements.txt new file mode 100644 index 00000000000..d2241fdcc2b --- /dev/null +++ b/suggestion/bayesianoptimization/requirements.txt @@ -0,0 +1,4 @@ +grpcio +numpy>=1.13.3 +scikit-learn>=0.19.0 +scipy>=0.19.1 diff --git a/suggestion/bayesianoptimization/src/__init__.py b/suggestion/bayesianoptimization/src/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/suggestion/bayesianoptimization/src/acquisition_func/__init__.py b/suggestion/bayesianoptimization/src/acquisition_func/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/suggestion/bayesianoptimization/src/acquisition_func/acquisition_func.py b/suggestion/bayesianoptimization/src/acquisition_func/acquisition_func.py new file mode 100644 index 00000000000..d8241b661e7 --- /dev/null +++ b/suggestion/bayesianoptimization/src/acquisition_func/acquisition_func.py @@ -0,0 +1,43 @@ +""" module for acquisition function""" +import numpy as np +from scipy.stats import norm + +from suggestion.bayesianoptimization.src.model.Model import Model + + +class AcquisitionFunc: + """ class for acquisition function + expected improvement in this case + """ + def __init__(self, X_train, y_train, current_optimal, mode, trade_off, length_scale, noise, nu, kernel_type): + """ + :param mode: pi: probability of improvement, ei: expected improvement, lcb: lower confident bound + :param trade_off: a parameter to control the trade off between exploiting and exploring + """ + self.X_train = X_train + self.y_train = y_train + self.current_optimal = current_optimal + self.mode = mode or "ei" + self.trade_off = trade_off or 0.01 + self.model = Model( + length_scale=length_scale, + noise=noise, + nu=nu, + kernel_type=kernel_type, + ) + + def compute(self, X_test): + self.model.gp.fit(self.X_train, self.y_train) + y_mean, y_std = self.model.gp.predict(X_test, return_std=True) + y_variance = y_std ** 2 + z = (y_mean - self.current_optimal - self.trade_off) / y_std + + if self.mode == "ei": + if y_std < 0.000001: + return 0, y_mean, y_variance + result = y_std * (z * norm.cdf(z) + norm.pdf(z)) + elif self.mode == "pi": + result = norm.cdf(z) + else: + result = - (y_mean - self.trade_off * y_std) + return np.squeeze(result), np.squeeze(y_mean), np.squeeze(y_variance) diff --git a/suggestion/bayesianoptimization/src/algorithm_manager.py b/suggestion/bayesianoptimization/src/algorithm_manager.py new file mode 100644 index 00000000000..c64f8475c88 --- /dev/null +++ b/suggestion/bayesianoptimization/src/algorithm_manager.py @@ -0,0 +1,204 @@ +""" module for algorithm manager """ + +import numpy as np + +from api.python import api_pb2 + + +def deal_with_discrete(feasible_values, current_value): + """ function to embed the current values to the feasible discrete space""" + diff = np.subtract(feasible_values, current_value) + diff = np.absolute(diff) + return feasible_values[np.argmin(diff)] + + +def deal_with_categorical(feasible_values, one_hot_values): + """ function to do the one hot encoding of the categorical values """ + index = np.argmax(one_hot_values) + return feasible_values[index] + + +class AlgorithmManager: + """ class for the algorithm manager + provide some helper functions + """ + def __init__(self, study_id, study_config, X_train, y_train): + self._study_id = study_id + self._study_config = study_config + self._goal = self._study_config.optimization_type + self._dim = 0 + self._lowerbound = [] + self._upperbound = [] + self._types = [] + self._names = [] + # record all the feasible values of discrete type variables + self._discrete_info = [] + self._categorical_info = [] + + self._parse_config() + + self._X_train = X_train + self.parse_X() + + self._y_train = y_train + self._parse_metric() + + # print(self._X_train) + # print(self._y_train) + + @property + def study_id(self): + """ return the study id """ + return self._study_id + + @property + def study_config(self): + """ return the study configuration """ + return self._study_config + + @property + def goal(self): + """ return the optimization goal""" + return self._goal + + @property + def dim(self): + """ return the dimension """ + return self._dim + + @property + def lower_bound(self): + """ return the lower bound of all the parameters """ + return self._lowerbound + + @property + def upper_bound(self): + """ return the ipper bound of all the parameters """ + return self._upperbound + + @property + def types(self): + """ return the types of all the parameters """ + return self._types + + @property + def names(self): + """ return the names of all the parameters """ + return self._names + + @property + def discrete_info(self): + """ return the info of all the discrete parameters """ + return self._discrete_info + + @property + def categorical_info(self): + """ return the info of all the categorical parameters """ + return self._categorical_info + + @property + def X_train(self): + """ return the training data """ + return self._X_train + + @property + def y_train(self): + """ return the target of the training data""" + return self._y_train + + def _parse_config(self): + """ extract info from the study configuration """ + for param in self._study_config.parameter_configs.configs: + self._types.append(param.parameter_type) + self._names.append(param.name) + if param.parameter_type == api_pb2.DOUBLE or param.parameter_type == api_pb2.INT: + self._dim = self._dim + 1 + self._lowerbound.append(float(param.feasible.min)) + self._upperbound.append(float(param.feasible.max)) + elif param.parameter_type == api_pb2.DISCRETE: + self._dim = self._dim + 1 + discrete_values = [int(x) for x in param.feasible.list] + min_value = min(discrete_values) + max_value = max(discrete_values) + self._lowerbound.append(min_value) + self._upperbound.append(max_value) + self._discrete_info.append(dict({ + "name": param.name, + "values": discrete_values, + })) + # one hot encoding for categorical type + elif param.parameter_type == api_pb2.CATEGORICAL: + num_feasible = len(param.feasible.list) + for i in range(num_feasible): + self._lowerbound.append(0) + self._upperbound.append(1) + self._categorical_info.append(dict({ + "name": param.name, + "values": param.feasible.list, + "number": num_feasible, + })) + self._dim += num_feasible + + def _parse_metric(self): + """ parse the metric to the dictionary """ + if not self._y_train: + self._y_train = None + return + y = [] + for metric in self._y_train: + if self._goal == api_pb2.MAXIMIZE: + y.append(float(metric)) + else: + y.append(-float(metric)) + + self._y_train = np.array(y) + + def parse_X(self): + if not self._X_train: + self._X_train = None + return + + self._X_train = np.array(self._X_train) + + def parse_x_next(self, x_next): + """ parse the next suggestion to the proper format """ + counter = 0 + result = [] + for i in range(len(self._types)): + if self._types[i] == api_pb2.INT: + result.append(int(round(x_next[counter], 0))) + counter = counter + 1 + elif self._types[i] == api_pb2.DISCRETE: + for param in self._discrete_info: + if param["name"] == self._names[i]: + result.append( + deal_with_discrete(param["values"], x_next[counter]) + ) + counter = counter + 1 + break + elif self._types[i] == api_pb2.CATEGORICAL: + for param in self._categorical_info: + if param["name"] == self._names[i]: + result.append(deal_with_categorical( + feasible_values=param["values"], + one_hot_values=x_next[counter:counter + param["number"]], + )) + counter = counter + param["number"] + break + elif self._types[i] == api_pb2.DOUBLE: + result.append(x_next[counter]) + counter = counter + 1 + return result + + def convert_to_dict(self, x_next): + """ convert the next suggestion to the dictionary """ + result = [] + for i in range(len(x_next)): + tmp = dict({ + "name": self._names[i], + "value": x_next[i], + "type": self._types[i], + }) + result.append(tmp) + return result + diff --git a/suggestion/bayesianoptimization/src/bayesian_optimization_algorithm.py b/suggestion/bayesianoptimization/src/bayesian_optimization_algorithm.py new file mode 100644 index 00000000000..987cc46c8dc --- /dev/null +++ b/suggestion/bayesianoptimization/src/bayesian_optimization_algorithm.py @@ -0,0 +1,58 @@ +""" module for bayesian optimization algorithm """ +import numpy as np +from sklearn.preprocessing import MinMaxScaler + +from suggestion.bayesianoptimization.src.global_optimizer.global_optimizer import GlobalOptimizer + + +class BOAlgorithm: + """ class for bayesian optimization """ + def __init__(self, dim, N, lowerbound, upperbound, X_train, y_train, mode, trade_off, + length_scale, noise, nu, kernel_type): + # np.random.seed(0) + self.dim = dim + self.N = N or 100 + self.l = np.zeros((1, dim)) + self.u = np.ones((1, dim)) + self.lowerbound = lowerbound.reshape(1, dim) + self.upperbound = upperbound.reshape(1, dim) + + # normalize the upperbound and lowerbound to [0, 1] + self.scaler = MinMaxScaler() + self.scaler.fit(np.append(self.lowerbound, self.upperbound, axis=0)) + + self.x_next = None + self.X_train = X_train + self.y_train = y_train + if self.y_train is None: + self.current_optimal = None + else: + self.current_optimal = max(self.y_train) + + # initialize the global optimizer + self.optimizer = GlobalOptimizer( + N, + self.l, + self.u, + self.scaler, + self.X_train, + self.y_train, + self.current_optimal, + mode=mode, + trade_off=trade_off, + length_scale=length_scale, + noise=noise, + nu=nu, + kernel_type=kernel_type, + ) + + def get_suggestion(self): + """ main function to provide suggestion """ + if self.X_train is None and self.y_train is None and self.current_optimal is None: + # randomly pick a point as the first trial + self.x_next = np.random.uniform(self.lowerbound, self.upperbound, size=(1, self.dim)) + return self.x_next + _, self.x_next = self.optimizer.direct() + self.x_next = np.array(self.x_next).reshape(1, self.dim) + self.x_next = self.scaler.inverse_transform(self.x_next) + return self.x_next diff --git a/suggestion/bayesianoptimization/src/global_optimizer/__init__.py b/suggestion/bayesianoptimization/src/global_optimizer/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/suggestion/bayesianoptimization/src/global_optimizer/global_optimizer.py b/suggestion/bayesianoptimization/src/global_optimizer/global_optimizer.py new file mode 100644 index 00000000000..5aeac887dfe --- /dev/null +++ b/suggestion/bayesianoptimization/src/global_optimizer/global_optimizer.py @@ -0,0 +1,264 @@ +""" module for the global optimizer +DIRECT algorithm is used in this case +""" +import copy +import numpy as np + +from suggestion.bayesianoptimization.src.acquisition_func.acquisition_func import AcquisitionFunc + + +class RectPack: + """ class for the rectangular + including border, center and acquisition function value + """ + + def __init__(self, l, u, division_num, dim, scaler, aq_func): + self.l = l + self.u = u + self.center = (l + u) / 2 + j = np.mod(division_num, dim) + k = (division_num - j) / dim + self.d = np.sqrt(j * np.power(3, float(-2 * (k + 1))) + (dim - j) * np.power(3, float(-2 * k))) / 2 + self.division_num = division_num + self.fc, _, _ = aq_func.compute(scaler.inverse_transform(self.center)) + self.fc = -self.fc + + +class RectBucket: + """ class for the rectangular bucket + rectangular with the same size are put in the same bucket + the rectangular is sorted by the acquisition function value + """ + + def __init__(self, diff, pack): + self.diff = diff + self.array = [pack] + + def insert(self, new_pack): + """ insert a new rectangular to a bucket """ + for i in range(len(self.array)): + if new_pack.fc < self.array[i].fc: + self.array.insert(i, new_pack) + return + self.array.append(new_pack) + + def delete(self): + """ delete the first rectangular""" + del self.array[0] + + def diff_exist(self, diff): + """ detect the size difference """ + return abs(self.diff - diff) < 0.00001 + + +class OptimalPoint: + """ helper class to find potential optimal points""" + + def __init__(self, point, prev, slope): + self.point = point + self.prev = prev + self.slope = slope + + +class DimPack: + def __init__(self, dim, fc): + self.dim = dim + self.fc = fc + + +class GlobalOptimizer: + """ class for the global optimizer """ + + def __init__(self, N, l, u, scaler, X_train, y_train, current_optimal, mode, trade_off, length_scale, + noise, nu, kernel_type): + self.N = N + self.l = l + self.u = u + self.scaler = scaler + self.buckets = [] + self.dim = None + self.aq_func = AcquisitionFunc( + X_train=X_train, + y_train=y_train, + current_optimal=current_optimal, + mode=mode, + trade_off=trade_off, + length_scale=length_scale, + noise=noise, + nu=nu, + kernel_type=kernel_type, + ) + + def potential_opt(self, f_min): + """ find the potential optimal rectangular """ + b = [] + for i in range(len(self.buckets)): + b.append(self.buckets[i].array[0]) + b.sort(key=lambda x: x.d) + index = 0 + min_fc = b[0].fc + for i in range(len(b)): + if b[i].fc < min_fc: + min_fc = b[i].fc + index = i + + opt_list = [OptimalPoint(b[index], 0, 0)] + for i in range(index + 1, len(b)): + prev = len(opt_list) - 1 + diff1 = b[i].d + diff2 = opt_list[prev].point.d + current_slope = (b[i].fc - opt_list[prev].point.fc) / (diff1 - diff2) + prev_slope = opt_list[prev].slope + + while prev >= 0 and current_slope < prev_slope: + temp = opt_list[prev].prev + opt_list[prev].prev = -1 + prev = temp + prev_slope = opt_list[prev].slope + diff1 = b[i].d + diff2 = opt_list[prev].point.d + current_slope = (b[i].fc - opt_list[prev].point.fc) / (diff1 - diff2) + + opt_list.append(OptimalPoint(b[i], prev, current_slope)) + + opt_list2 = [] + for i in range(len(opt_list)): + if opt_list[i].prev != -1: + opt_list2.append(opt_list[i]) + + for i in range(len(opt_list2) - 1): + c1 = opt_list2[i].point.d + c2 = opt_list2[i + 1].point.d + fc1 = opt_list2[i].point.fc + fc2 = opt_list2[i + 1].point.fc + if fc1 - c1 * (fc1 - fc2) / (c1 - c2) > (1 - 0.001) * f_min: + # if abs(fc1-fc2)<0.0001: + opt_list2[i] = None + while None in opt_list2: + index = opt_list2.index(None) + del opt_list2[index] + # for opt in opt_list2: + # print(opt.point.fc) + return opt_list2 + + def direct(self): + """ main algorithm """ + self.dim = self.l.shape[1] + division_num = 0 + + # create the first rectangle and put it in the first bucket + first_rect = RectPack(self.l, self.u, division_num, self.dim, + self.scaler, self.aq_func) + self.buckets.append(RectBucket(first_rect.d, first_rect)) + + ei_min = [] + f_min = first_rect.fc + x_next = first_rect.center + ei_min.append(f_min) + + for t in range(self.N): + opt_set = self.potential_opt(f_min) + + # for bucket in self.buckets: + # for i in range(len(bucket.array)): + # print(bucket.array[i].fc) + # plt.plot(bucket.diff, bucket.array[i].fc, 'b.') + # + # for opt in opt_set: + # plt.plot(opt.point.d, opt.point.fc, 'r.') + # plt.show() + + for opt in opt_set: + f_min, x_next = self.divide_rect( + opt.point, + f_min, + x_next, + self.aq_func, + self.scaler + ) + for bucket in self.buckets: + if bucket.diff_exist(opt.point.d): + bucket.delete() + if not bucket.array: + index = self.buckets.index(bucket) + del self.buckets[index] + + ei_min.append(f_min) + return f_min, x_next + + def divide_rect(self, opt_rect, f_min, x_next, aq_func, scaler): + """ divide the rectangular into smaller ones """ + rect = copy.deepcopy(opt_rect) + division_num = rect.division_num + j = np.mod(division_num, self.dim) + k = (division_num - j) / self.dim + max_side_len = np.power(3, float(-k)) + delta = max_side_len / 3 + dim_set = [] + for i in range(self.dim): + if abs(max_side_len - (rect.u[0, i] - rect.l[0, i])) < 0.0000001: + dim_set.append(i) + + dim_list = [] + for i in dim_set: + e = np.zeros((1, self.dim)) + e[0, i] = 1 + function_value = min( + aq_func.compute(scaler.inverse_transform(rect.center + delta * e)), + aq_func.compute(scaler.inverse_transform(rect.center - delta * e)) + ) + dim_list.append(DimPack(i, function_value)) + dim_list.sort(key=lambda x: x.fc) + + for i in range(len(dim_list)): + division_num = division_num + 1 + temp = np.zeros((1, self.dim)) + temp[0, dim_list[i].dim] = delta + left_rect = RectPack( + rect.l, + rect.u - 2 * temp, + division_num, + self.dim, + self.scaler, + aq_func + ) + middle_rect = RectPack( + rect.l + temp, + rect.u - temp, + division_num, + self.dim, + self.scaler, + aq_func + ) + right_rect = RectPack( + rect.l + 2 * temp, + rect.u, + division_num, + self.dim, + self.scaler, + aq_func + ) + if left_rect.fc < f_min: + f_min = left_rect.fc + x_next = left_rect.center + if right_rect.fc < f_min: + f_min = right_rect.fc + x_next = right_rect.center + + insert = 0 + for bucket in self.buckets: + if bucket.diff_exist(left_rect.d): + bucket.insert(left_rect) + bucket.insert(right_rect) + if i == len(dim_list) - 1: + bucket.insert(middle_rect) + insert = 1 + break + if insert == 0: + new_bucket = RectBucket(left_rect.d, left_rect) + new_bucket.insert(right_rect) + if i == len(dim_list) - 1: + new_bucket.insert(middle_rect) + self.buckets.append(new_bucket) + rect = middle_rect + return f_min, x_next diff --git a/suggestion/bayesianoptimization/src/model/Model.py b/suggestion/bayesianoptimization/src/model/Model.py new file mode 100644 index 00000000000..b23e393e5a2 --- /dev/null +++ b/suggestion/bayesianoptimization/src/model/Model.py @@ -0,0 +1,34 @@ +""" module for gaussian process prior """ +from sklearn.gaussian_process.kernels import RBF, Matern +from sklearn.gaussian_process import GaussianProcessRegressor + + +class Model: + """ use the gaussian process as a prior """ + def __init__(self, length_scale, noise, nu, kernel_type): + """ + :param length_scale: the larger the length_scale is, the smoother the gaussian prior is. If a float, + an isotropic kernel is used. If an array, an anisotropic kernel is used where each dimension of it defines + the length-scale of the respective feature dimension. + :param noise: + :param nu: control the smoothness of the prior using Matern kernel. The larger nu is, the smoother the + approximate function is. + :param kernel_type: "rbf": squared exponential kernel, "matern": Matern kernel. + """ + + length_scale = length_scale or 0.5 + noise = noise or 0.00005 + nu = nu or 1.5 + kernel_type = kernel_type or "matern" + + if kernel_type == "rbf": + kernel = RBF(length_scale=length_scale) + else: + kernel = Matern(length_scale=length_scale, nu=nu) + + self.gp = GaussianProcessRegressor( + kernel=kernel, + alpha=noise, + random_state=0, + optimizer=None, + ) diff --git a/suggestion/bayesianoptimization/src/model/__init__.py b/suggestion/bayesianoptimization/src/model/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/suggestion/test_client.py b/suggestion/test_client.py new file mode 100644 index 00000000000..7dda4362c14 --- /dev/null +++ b/suggestion/test_client.py @@ -0,0 +1,133 @@ +import grpc + +from api.python import api_pb2 +from api.python import api_pb2_grpc +from suggestion.test_func import func +from suggestion.types import DEFAULT_PORT + + +def run(): + channel = grpc.insecure_channel(DEFAULT_PORT) + stub = api_pb2_grpc.SuggestionStub(channel) + set_param_response = stub.SetSuggestionParameters(api_pb2.SetSuggestionParametersRequest( + study_id="1", + suggestion_parameters=[ + api_pb2.SuggestionParameter( + name="N", + value="100", + ), + api_pb2.SuggestionParameter( + name="kernel_type", + value="matern", + ), + api_pb2.SuggestionParameter( + name="mode", + value="ei", + ), + api_pb2.SuggestionParameter( + name="trade_off", + value="0.01", + ) + ] + )) + completed_trials = [] + maximum = -1 + iter = 0 + for i in range(30): + response = stub.GenerateTrials(api_pb2.GenerateTrialsRequest( + study_id="1", + configs=api_pb2.StudyConfig( + name="test_study", + owner="me", + optimization_type=api_pb2.MAXIMIZE, + optimization_goal=0.2, + parameter_configs=api_pb2.StudyConfig.ParameterConfigs( + configs=[ + # api_pb2.ParameterConfig( + # name="param1", + # parameter_type=api_pb2.INT, + # feasible=api_pb2.FeasibleSpace(max="5", min="1", list=[]), + # ), + # api_pb2.ParameterConfig( + # name="param2", + # parameter_type=api_pb2.CATEGORICAL, + # feasible=api_pb2.FeasibleSpace(max=None, min=None, list=["cat1", "cat2", "cat3"]) + # ), + # api_pb2.ParameterConfig( + # name="param3", + # parameter_type=api_pb2.DISCRETE, + # feasible=api_pb2.FeasibleSpace(max=None, min=None, list=["3", "2", "6"]) + # ), + # api_pb2.ParameterConfig( + # name="param4", + # parameter_type=api_pb2.DOUBLE, + # feasible=api_pb2.FeasibleSpace(max="5", min="1", list=[]) + # ) + api_pb2.ParameterConfig( + name="param1", + parameter_type=api_pb2.DOUBLE, + feasible=api_pb2.FeasibleSpace(max="1", min="0", list=[]), + ), + api_pb2.ParameterConfig( + name="param2", + parameter_type=api_pb2.DOUBLE, + feasible=api_pb2.FeasibleSpace(max="1", min="0", list=[]) + ), + ], + ), + access_permissions=[], + suggest_algorithm="BO", + autostop_algorithm="", + study_task_name="task", + suggestion_parameters=[], + tags=[], + objective_value_name="precision", + metrics=[], + image="", + command=["", ""], + gpu=0, + scheduler="", + mount=api_pb2.MountConf( + pvc="", + path="", + ), + pull_secret="" + ), + completed_trials=completed_trials, + running_trials=[],) + ) + x1 = response.trials[0].parameter_set[0].value + x2 = response.trials[0].parameter_set[1].value + objective_value = func(float(x1), float(x2)) + if objective_value > maximum: + maximum = objective_value + iter = i + print(objective_value) + completed_trials.append(api_pb2.Trial( + trial_id=response.trials[0].trial_id, + study_id="1", + status=api_pb2.COMPLETED, + eval_logs=[], + objective_value=str(objective_value), + parameter_set=[ + api_pb2.Parameter( + name="param1", + parameter_type=api_pb2.DOUBLE, + value=x1, + ), + api_pb2.Parameter( + name="param2", + parameter_type=api_pb2.DOUBLE, + value=x2, + ), + ] + )) + print(str(response.trials[0].parameter_set)) + stop_study_response = stub.StopSuggestion(api_pb2.StopStudyRequest( + study_id="1" + )) + + print("found the maximum: {} at {} iteration".format(maximum, iter)) + +if __name__ == "__main__": + run() diff --git a/suggestion/test_func.py b/suggestion/test_func.py new file mode 100644 index 00000000000..7587442284e --- /dev/null +++ b/suggestion/test_func.py @@ -0,0 +1,9 @@ +import numpy as np + + +def func(x1, x2): + return 0.75 * np.exp(-(9 * x1-2) ** 2 / 4 - (9 * x2-2) ** 2 / 4) + 0.75 * np.exp( + -(9 * x1 + 1) ** 2 / 49 - (9 * x2 + 1) / 10) + \ + 0.5 * np.exp(-(9 * x1 - 7) ** 2 / 4 - (9 * x2 - 3) ** 2 / 4) - 0.2 * np.exp( + -(9 * x1 - 4) ** 2 - (9 * x2 - 7) ** 2) + diff --git a/suggestion/types.py b/suggestion/types.py new file mode 100644 index 00000000000..592f4450a13 --- /dev/null +++ b/suggestion/types.py @@ -0,0 +1 @@ +DEFAULT_PORT = "0.0.0.0:6789" diff --git a/test/scripts/build.sh b/test/scripts/build.sh index cc7dc29760b..7e99468f523 100755 --- a/test/scripts/build.sh +++ b/test/scripts/build.sh @@ -52,6 +52,8 @@ cp suggestion/grid/Dockerfile . gcloud container builds submit . --tag=${REGISTRY}/${REPO_NAME}/suggestion-grid:${VERSION} --project=${PROJECT} cp suggestion/hyperband/Dockerfile . gcloud container builds submit . --tag=${REGISTRY}/${REPO_NAME}/suggestion-hyperband:${VERSION} --project=${PROJECT} +cp suggestion/bayesianoptimization/Dockerfile . +gcloud container builds submit . --tag=${REGISTRY}/${REPO_NAME}/suggestion-bayesianoptimization:${VERSION} --project=${PROJECT} cp earlystopping/medianstopping/Dockerfile . gcloud container builds submit . --tag=${REGISTRY}/${REPO_NAME}/earlystopping-medianstopping:${VERSION} --project=${PROJECT} cp dlk/Dockerfile . diff --git a/test/scripts/run-tests.sh b/test/scripts/run-tests.sh index 6560e537d89..de2e171eb79 100755 --- a/test/scripts/run-tests.sh +++ b/test/scripts/run-tests.sh @@ -46,6 +46,7 @@ sed -i -e "s@image: katib\/vizier-core@image: ${REGISTRY}\/${REPO_NAME}\/vizier- sed -i -e "s@image: katib\/suggestion-random@image: ${REGISTRY}\/${REPO_NAME}\/suggestion-random:${VERSION}@" manifests/vizier/suggestion/random/deployment.yaml sed -i -e "s@image: katib\/suggestion-grid@image: ${REGISTRY}\/${REPO_NAME}\/suggestion-grid:${VERSION}@" manifests/vizier/suggestion/grid/deployment.yaml sed -i -e "s@image: katib\/suggestion-hyperband@image: ${REGISTRY}\/${REPO_NAME}\/suggestion-hyperband:${VERSION}@" manifests/vizier/suggestion/hyperband/deployment.yaml +sed -i -e "s@image: katib\/suggestion-bayesianoptimization@image: ${REGISTRY}\/${REPO_NAME}\/suggestion-bayesianoptimization:${VERSION}@" manifests/vizier/suggestion/bayesianoptimization/deployment.yaml sed -i -e "s@image: katib\/earlystopping-medianstopping@image: ${REGISTRY}\/${REPO_NAME}\/earlystopping-medianstopping:${VERSION}@" manifests/vizier/earlystopping/medianstopping/deployment.yaml sed -i -e "s@image: katib\/dlk-manager@image: ${REGISTRY}\/${REPO_NAME}\/dlk-manager:${VERSION}@" manifests/dlk/deployment.yaml sed -i -e "s@image: katib\/katib-frontend@image: ${REGISTRY}\/${REPO_NAME}\/katib-frontend:${VERSION}@" manifests/modeldb/frontend/deployment.yaml