orhankislal commented on a change in pull request #372: DL: Trap unsupported
options for compile and fit params
URL: https://github.com/apache/madlib/pull/372#discussion_r279045562
##########
File path: src/ports/postgres/modules/deep_learning/madlib_keras_wrapper.py_in
##########
@@ -120,9 +121,14 @@ def parse_compile_params(str_of_args):
opt_name,opt_args = parse_optimizer(compile_dict)
compile_dict['loss'] = parse_loss(compile_dict)
+ accepted_compile_params = ['metrics', 'loss_weights', 'weighted_metrics',
'sample_weight_mode']
- 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
+ for key in accepted_compile_params:
+ try:
+ compile_dict[key] = ast.literal_eval(compile_dict[key]) if key in
compile_dict.keys() else None
+ except ValueError:
Review comment:
Renamed and refactored the functions to make it a bit more consistent.
----------------------------------------------------------------
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