You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@madlib.apache.org by GitBox <gi...@apache.org> on 2019/04/15 18:27:01 UTC

[GitHub] [madlib] orhankislal commented on a change in pull request #367: DL: Remove reshaping for input/validation dataset

orhankislal commented on a change in pull request #367: DL: Remove reshaping for input/validation dataset
URL: https://github.com/apache/madlib/pull/367#discussion_r275007662
 
 

 ##########
 File path: src/ports/postgres/modules/deep_learning/madlib_keras.py_in
 ##########
 @@ -487,31 +459,23 @@ def evaluate1(schema_madlib, model_table, test_table, id_col, model_arch_table,
         plpy.error("no model arch found in table {0} with id {1}".format(
             model_arch_table, model_arch_id))
     query_result = query_result[0]
-    model_arch = query_result['model_arch']
-    input_shape = get_input_shape(model_arch)
+    model_arch = query_result[Format.MODEL_ARCH]
     compile_params = "$madlib$" + compile_params + "$madlib$"
-    # evaluate_query = plpy.prepare("""create table {output_table} as
-    evaluate_query = plpy.prepare("""
-        select {id_col}, (madlib.internal_keras_evaluate({independent_varname},
-                                             {dependent_varname},
-                                             $MAD${model_arch}$MAD$,
-                                             $1,ARRAY{input_shape},
-                                             {compile_params}))
-        from {test_table}""".format(**locals()), ["bytea"])
-    plpy.execute(evaluate_query, [model_data])
-
-def internal_keras_evaluate(x_test, y_test, model_arch, model_data, input_shape,
-                           compile_params):
-    device_name = '/cpu:0'
-    os.environ["CUDA_VISIBLE_DEVICES"] = '-1'
-
-    model = model_from_json(model_arch)
-    plpy.info('model in str is {}'.format(str(model)))
 
-    model_shapes = []
-    for weight_arr in model.get_weights():
-        model_shapes.append(weight_arr.shape)
-    _, model_weights = KerasWeightsSerializer.deserialize_weights(
+    loss_acc = get_loss_acc_from_keras_eval(schema_madlib, test_table, dependent_varname,
+                                            independent_varname, compile_params, model_arch,
+                                            model_data, False)
+    #TODO remove these infos after adding create table command
 
 Review comment:
   We should remove these lines before merging.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services