kaknikhil 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_r279040801
##########
File path: src/ports/postgres/modules/deep_learning/madlib_keras_wrapper.py_in
##########
@@ -199,7 +215,34 @@ def get_optimizers():
def compile_model(model, compile_params):
optimizers = get_optimizers()
(opt_name,final_args,compile_dict) = parse_compile_params(compile_params)
- optimizer = optimizers[opt_name](**final_args) if final_args else opt_name
- model.compile(optimizer=optimizer,
- loss=compile_dict['loss'],
- metrics=compile_dict['metrics'])
+ compile_dict['optimizer'] = optimizers[opt_name](**final_args) if
final_args else opt_name
+ validate_compile_params(compile_dict)
+ model.compile(**compile_dict)
+
+def validate_compile_params(compile_dict):
+ _assert(compile_dict['metrics'] is None or type(compile_dict['metrics'])
is list,
+ "wrong input type for compile parameter metrics: multi-output
model"
+ "is not supported yet, please pass a list")
Review comment:
I see thanks.
But what if the user passes in just a string? The check will fail and we
will print the wrong error message
----------------------------------------------------------------
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