kaknikhil commented on a change in pull request #380: DL: Add negative unit 
tests for unsupported compile and fit params
URL: https://github.com/apache/madlib/pull/380#discussion_r279889723
 
 

 ##########
 File path: 
src/ports/postgres/modules/deep_learning/test/unit_tests/test_madlib_keras.py_in
 ##########
 @@ -443,6 +443,79 @@ class MadlibKerasFitTestCase(unittest.TestCase):
                             accepted_fit_params)
         self.assertDictEqual(result_params, target_dict)
 
+    def test_parse_and_validate_compile_params_invalid_metrics(self):
+        test_str = "optimizer=SGD(lr=0.01, decay=1e-6, nesterov=True), 
loss='categorical_crossentropy', metrics={'0':'accuracy'}"
+
+        with self.assertRaises(plpy.PLPYException):
+            opt_name,opt_args,result_params = 
self.subject.parse_and_validate_compile_params(test_str)
+
+    def test_parse_and_validate_compile_params_invalid_loss_weights(self):
+
+        test_str = "optimizer=SGD(lr=0.01, decay=1e-6, nesterov=True), 
loss='categorical_crossentropy', metrics=['accuracy'], loss_weights = 
keras.layers.Input(shape=(32,))"
+
+        with self.assertRaises(plpy.PLPYException):
+            opt_name,opt_args,result_params = 
self.subject.parse_and_validate_compile_params(test_str)
+
+
+    def 
test_parse_and_validate_compile_params_invalid_sample_weight_mode(self):
+        test_str = "optimizer=SGD(lr=0.01, decay=1e-6, nesterov=True), 
loss='categorical_crossentropy', metrics=['accuracy'], sample_weight_mode = 
[0,1]"
+
+        with self.assertRaises(plpy.PLPYException):
+            opt_name,opt_args,result_params = 
self.subject.parse_and_validate_compile_params(test_str)
+
+        test_str = "optimizer=SGD(lr=0.01, decay=1e-6, nesterov=True), 
loss='categorical_crossentropy', metrics=['accuracy'], sample_weight_mode = 
{'0':'1'}"
+
+        with self.assertRaises(plpy.PLPYException):
+            opt_name,opt_args,result_params = 
self.subject.parse_and_validate_compile_params(test_str)
+
+
+    def test_parse_and_validate_compile_params_invalid_target_tensors(self):
+        test_str = "optimizer=SGD(lr=0.01, decay=1e-6, nesterov=True), 
loss='categorical_crossentropy', metrics=['accuracy'], target_tensors = 
keras.layers.Input(shape=(32,))"
+
+        with self.assertRaises(plpy.PLPYException):
+            opt_name,opt_args,result_params = 
self.subject.parse_and_validate_compile_params(test_str)
+
+## Negative Tests
 
 Review comment:
   Should we move this comment up above the first negative unit test for 
compile params?

----------------------------------------------------------------
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

Reply via email to