kaknikhil commented on a change in pull request #368: DL: Add alternative
options for compile params
URL: https://github.com/apache/madlib/pull/368#discussion_r275468723
##########
File path: src/ports/postgres/modules/deep_learning/madlib_keras_wrapper.py_in
##########
@@ -120,15 +122,27 @@ def parse_compile_params(str_of_args):
compile_dict['metrics'] = ast.literal_eval(compile_dict['metrics']) if
'metrics' in compile_dict.keys() else None
compile_dict['loss_weights'] =
ast.literal_eval(compile_dict['loss_weights']) if 'loss_weights' in
compile_dict.keys() else None
- opt_name = compile_dict['optimizer'].split('(')[0]
+ opt_split = compile_dict['optimizer'].split('(')
+ opt_name = opt_split[0]
optimizers = get_optimizers()
_assert(opt_name in optimizers,
"model_keras error: invalid optimizer name: {0}".format(opt_name))
- opt_params = compile_dict['optimizer'].split('(')[1][:-1]
- opt_params_array = opt_params.split(',')
- opt_params_clean = map(split_and_strip, opt_params_array)
- key_value_params = { x[0] : x[1] for x in opt_params_clean}
- final_args = { key: bool(value) if value == 'True' or value == 'False'
else float(value) for key,value in key_value_params.iteritems() }
+ if len(opt_split) == 1:
+ final_args = None
+ else:
+ opt_params = compile_dict['optimizer'].split('(')[1][:-1]
+ opt_params_array = opt_params.split(',')
+ opt_params_clean = map(split_and_strip, opt_params_array)
+ key_value_params = { x[0] : x[1] for x in opt_params_clean}
+ final_args = { key: bool(value) if value == 'True' or value == 'False'
+ else float(value)
+ for key,value in key_value_params.iteritems() }
+
+ loss_split = compile_dict['loss'].split('.')
Review comment:
What will happen if the user passes `categorical_crossentropy` (which can be
a valid value) without quotes ? We should be very clear in our docs about what
is allowed and what isn't.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services