You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ri...@apache.org on 2015/12/04 23:32:41 UTC

incubator-madlib git commit: SVM: Allow grouping_col to be empty

Repository: incubator-madlib
Updated Branches:
  refs/heads/master 72966db43 -> cd12983cb


SVM: Allow grouping_col to be empty

This closes #6

- Fix "verbose" KeyError in in_mem_group_contol
- SVM: explicitly set grouping_col to None so that
grouping_col can be empty string or NULL.


Project: http://git-wip-us.apache.org/repos/asf/incubator-madlib/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-madlib/commit/cd12983c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-madlib/tree/cd12983c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-madlib/diff/cd12983c

Branch: refs/heads/master
Commit: cd12983cb49f580f5d58fb866606bce816631c36
Parents: 72966db
Author: Xiaocheng Tang <xi...@gmail.com>
Authored: Fri Dec 4 14:31:05 2015 -0800
Committer: Rahul Iyer <ri...@pivotal.io>
Committed: Fri Dec 4 14:31:05 2015 -0800

----------------------------------------------------------------------
 src/ports/postgres/modules/svm/svm.py_in                     | 8 ++++++--
 .../postgres/modules/utilities/in_mem_group_control.py_in    | 5 +++--
 2 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/cd12983c/src/ports/postgres/modules/svm/svm.py_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/svm/svm.py_in b/src/ports/postgres/modules/svm/svm.py_in
index 20c6d7f..3cdfb5f 100644
--- a/src/ports/postgres/modules/svm/svm.py_in
+++ b/src/ports/postgres/modules/svm/svm.py_in
@@ -116,7 +116,9 @@ def _verify_grouping(schema_madlib, source_table, grouping_col):
         grouping_str = ','.join(grouping_list)
     else:
         grouping_str = "Null"
-    return grouping_str
+        grouping_col = None
+
+    return grouping_str, grouping_col
 
 
 def _verify_kernel(kernel_func):
@@ -328,7 +330,9 @@ def _svm_parsed_params(schema_madlib, source_table, model_table,
     """
     Executes the linear support vector algorithm.
     """
-    grouping_str = _verify_grouping(schema_madlib, source_table, grouping_col)
+    grouping_str, grouping_col = _verify_grouping(schema_madlib, 
+                                                  source_table, 
+                                                  grouping_col)
 
     kernel_func = _verify_kernel(kernel_func)
 

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/cd12983c/src/ports/postgres/modules/utilities/in_mem_group_control.py_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/utilities/in_mem_group_control.py_in b/src/ports/postgres/modules/utilities/in_mem_group_control.py_in
index 08dd269..35ea306 100644
--- a/src/ports/postgres/modules/utilities/in_mem_group_control.py_in
+++ b/src/ports/postgres/modules/utilities/in_mem_group_control.py_in
@@ -167,6 +167,7 @@ class GroupIterationController:
         self.in_with = False
         self.iteration = -1
         self.is_group_null = True if arg_dict["grouping_col"] is None else False
+        self.verbose = arg_dict.get('verbose', False)
         self.kwargs = dict(arg_dict)
         self.kwargs.update(
             as_rel_source=arg_dict.get('as_rel_source', '_src'),
@@ -236,7 +237,7 @@ class GroupIterationController:
                           grouped_state_type=_grouped_state_type)
 
     def __enter__(self):
-        verbosity_level = "info" if self.kwargs['verbose'] else "error"
+        verbosity_level = "info" if self.verbose else "error"
         with MinWarning(verbosity_level):
             ############################
             # create state table
@@ -295,7 +296,7 @@ class GroupIterationController:
 
     def info(self):
         """ Logging intermediate state information """
-        if not self.kwargs['verbose']:
+        if not self.verbose:
             return
         group_param = self.group_param
         schema_madlib = self.kwargs['schema_madlib']