reductionista commented on a change in pull request #524: URL: https://github.com/apache/madlib/pull/524#discussion_r586813934
########## File path: src/ports/postgres/modules/deep_learning/madlib_keras_wrapper.py_in ########## @@ -287,27 +298,50 @@ def parse_optimizer(compile_dict): # Parse the fit parameters into a dictionary. -def parse_and_validate_fit_params(fit_param_str): +def parse_and_validate_fit_params(fit_param_str, current_seg_id=0): if fit_param_str: - fit_params_dict = convert_string_of_args_to_dict(fit_param_str) - - literal_eval_fit_params = ['batch_size','epochs','verbose', + fit_params_dict = convert_string_of_args_to_dict(fit_param_str, strip_quotes=False) + literal_eval_fit_params = ['batch_size','epochs','verbose', 'shuffle', Review comment: "In recent versions of keras, the optimizer classes are required to be passed in the normal pythonic way, as class variables." Correction: in recent versions, you can still pass optimizers in one of two ways, but I think the options are a bit more limited than in the past. Currently, you can pass either an optimizer object (instantiation of anything derived from `keras.optimizers.Optimizer`), or what you get when you call get_config['name'] on the default instantiation of one of the builtin optimizers, eg: `keras.optimizers.Adam().get_config()['name']` 'Adam' But it looks like for all the ones I've checked, the config name and the class name do still match. So I guess what I said above is only true for non-default instantiations of the class. Any of these are okay: ``` optmizer=Adam(learning_rate=0.01) optimizer=Adam(learning_rate=0.01, name='My custom Adam') optimizer='Adam' ``` but this is not: ``` optimizer='Adam(learning_rate=0.01)' ``` It looks like they have the same deal with losses and metrics, but for those the names of the classes don't necessarily match: ``` keras.losses.CategoricalCrossentropy().get_config()['name'] 'categorical_crossentropy' ``` ---------------------------------------------------------------- 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: us...@infra.apache.org