"vscode:/vscode.git/clone" did not exist on "92121fc66819444daba11bcb625826497a36c514"
Unverified Commit 93546854 authored by xuehui's avatar xuehui Committed by GitHub
Browse files

Support more data structure in tuner (#157)

* update readme in ga_squad

* update readme

* fix typo

* Update README.md

* Update README.md

* Update README.md

* update readme

* support key-value pairs in final result for tuner

* fix bug

* update warning message

* fix bug
parent 39085789
......@@ -111,11 +111,24 @@ class MsgDispatcher(MsgDispatcherBase):
def handle_report_metric_data(self, data):
if data['type'] == 'FINAL':
value = None
id_ = data['parameter_id']
if isinstance(data['value'], float) or isinstance(data['value'], int):
value = data['value']
elif isinstance(data['value'], dict) and 'default' in data['value']:
value = data['value']['default']
if isinstance(value, float) or isinstance(value, int):
pass
else:
raise RuntimeError('Incorrect final result: the final result should be float/int, or a dict which has a key named "default" whose value is float/int.')
else:
raise RuntimeError('Incorrect final result: the final result should be float/int, or a dict which has a key named "default" whose value is float/int.')
if id_ in _customized_parameter_ids:
self.tuner.receive_customized_trial_result(id_, _trial_params[id_], data['value'])
self.tuner.receive_customized_trial_result(id_, _trial_params[id_], value)
else:
self.tuner.receive_trial_result(id_, _trial_params[id_], data['value'])
self.tuner.receive_trial_result(id_, _trial_params[id_], value)
elif data['type'] == 'PERIODICAL':
if self.assessor is not None:
self._handle_intermediate_metric_data(data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment