madlib-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [madlib] kaknikhil commented on a change in pull request #361: Minibatch Preprocessor DL: Add optional num_classes param.
Date Mon, 01 Apr 2019 21:20:48 GMT
kaknikhil commented on a change in pull request #361: Minibatch Preprocessor DL: Add optional
num_classes param.
URL: https://github.com/apache/madlib/pull/361#discussion_r271054854
 
 

 ##########
 File path: src/ports/postgres/modules/utilities/test/unit_tests/test_minibatch_preprocessing.py_in
 ##########
 @@ -462,7 +487,80 @@ class MiniBatchPreProcessingDLTestCase(unittest.TestCase):
                                                 self.default_dep_var,
                                                 self.default_ind_var,
                                                 self.default_buffer_size,
-                                                -1)
+                                                -1,
+                                                self.default_num_classes)
+
+    def test_get_dep_var_array_expr_null_val(self):
+        self.module.get_expr_type = Mock(side_effect = ['integer[]', 'text'])
+        self.module.get_distinct_col_levels = Mock(return_value = ["NULL", "'a'"])
+        obj = self.module.MiniBatchPreProcessorDL(
+            self.default_schema_madlib,
+            self.default_source_table,
+            self.default_output_table,
+            self.default_dep_var,
+            self.default_ind_var,
+            self.default_buffer_size,
+            self.default_normalizing_const,
+            self.default_num_classes)
+        dep_var_array_expr = obj.get_dep_var_array_expr()
+        self.assertEqual("array[({0}) is not distinct from null, ({0}) is not distinct from
'a']::integer[]".
+                     format(self.default_dep_var),
+                     dep_var_array_expr.lower())
+
+    def test_get_dep_var_array_expr_numeric_array_val(self):
+        self.module.get_expr_type = Mock(side_effect = ['integer[]', 'integer[]'])
+        obj = self.module.MiniBatchPreProcessorDL(
+            self.default_schema_madlib,
+            self.default_source_table,
+            self.default_output_table,
+            self.default_dep_var,
+            self.default_ind_var,
+            self.default_buffer_size,
+            self.default_normalizing_const,
+            self.default_num_classes)
+        dep_var_array_expr = obj.get_dep_var_array_expr()
+        self.assertEqual("{0}::integer[]".
+                     format(self.default_dep_var),
+                     dep_var_array_expr.lower())
+
+    def test_validate_num_classes_none(self):
+        self.module.get_expr_type = Mock(side_effect = ['integer[]', 'text'])
+        obj = self.module.MiniBatchPreProcessorDL(
+            self.default_schema_madlib,
+            self.default_source_table,
+            self.default_output_table,
+            self.default_dep_var,
+            self.default_ind_var,
+            self.default_buffer_size,
+            self.default_normalizing_const,
+            None)
 
 Review comment:
   Can we add an assert here?

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

Mime
View raw message