khannaekta commented on a change in pull request #506:
URL: https://github.com/apache/madlib/pull/506#discussion_r465932779
##########
File path: src/ports/postgres/modules/deep_learning/madlib_keras_wrapper.py_in
##########
@@ -201,13 +201,14 @@ def parse_and_validate_compile_params(str_of_args):
"""
literal_eval_compile_params = ['metrics', 'loss_weights',
'weighted_metrics', 'sample_weight_mode']
- accepted_compile_params = literal_eval_compile_params + ['optimizer',
'loss']
+ accepted_compile_params = literal_eval_compile_params + ['optimizer',
'loss', 'optimizer_params_list']
compile_dict = convert_string_of_args_to_dict(str_of_args)
compile_dict = validate_and_literal_eval_keys(compile_dict,
literal_eval_compile_params,
accepted_compile_params)
- _assert('optimizer' in compile_dict, "optimizer is a required parameter
for compile")
+ # _assert('optimizer' in compile_dict, "optimizer is a required parameter
for compile")
Review comment:
Remove these commented out code.
##########
File path:
src/ports/postgres/modules/deep_learning/madlib_keras_model_selection.py_in
##########
@@ -442,28 +468,43 @@ class MstSearch():
if self.random_state:
np.random.seed(self.random_state+seed_changes)
seed_changes += 1
-
param_values = params_dict[cp]
-
- # sampling from a distribution
- if param_values[-1] in ['linear', 'log']:
- _assert(len(param_values) == 3,
- "DL: {0} should have exactly 3 elements if picking
from a distribution".format(cp))
- _assert(param_values[1] > param_values[0],
- "DL: {0} should be of the format [lower_bound,
uppper_bound, distribution_type]".format(cp))
- if param_values[-1] == 'linear':
- config_dict[cp] = np.random.uniform(param_values[0],
param_values[1])
- elif param_values[-1] == 'log':
- config_dict[cp] = np.power(10,
np.random.uniform(np.log10(param_values[0]),
-
np.log10(param_values[1])))
- else:
- plpy.error("DL: Choose a valid distribution type!
('linear' or 'log')")
- # random sampling
+ if cp == ModelSelectionSchema.OPTIMIZER_PARAMS_LIST:
+ opt_dict = np.random.choice(param_values)
+ opt_combination = {}
+ for i in opt_dict:
+ opt_values = opt_dict[i]
+ if self.random_state:
+ np.random.seed(self.random_state+seed_changes)
+ seed_changes += 1
+ opt_combination[i] = self.sample_val(cp, opt_values)
+ config_dict[cp] = opt_combination
else:
- config_dict[cp] = np.random.choice(params_dict[cp])
-
+ config_dict[cp] = self.sample_val(cp, param_values)
return config_dict, seed_changes
+ def sample_val(self, cp, param_value_list):
Review comment:
Good to have a comment for what this function does.
##########
File path:
src/ports/postgres/modules/deep_learning/test/unit_tests/test_madlib_keras_model_selection_table.py_in
##########
@@ -77,6 +373,8 @@ class LoadModelSelectionTableTestCase(unittest.TestCase):
"batch_size=10,epochs=1"
]
+ # plpy.execute("SELECT * FROM invalid_table;")
Review comment:
we can remove this comment code
----------------------------------------------------------------
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]