Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Based on the code in PR https://github.com/apache/madlib/pull/355:
Currently we have to pass in the compile_params and fit_params as follows
SELECT madlib.madlib_keras_fit(... , '''optimizer''=SGD(lr=0.01, decay=1e-6, nesterov=True), ''loss''=''categorical_crossentropy'', ''metrics''=[''accuracy'']'::text, ,'''batch_size''=2, ''epochs''=1, ''verbose''=0'::text ...)
Internally in the code we use a function called `convert_string_of_args_to_dict` which does some string parsing and then calls eval to create a dictionary. This is bug prone and unsafe. We should look into using the function `extract_keyvalue_params` (might have to change it. We can easily write a unit test for `extract_keyvalue_params`)
We should also think about how complicated compile_params can get and how can we generalize the code.