madlib-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jingyi...@apache.org
Subject [madlib] branch master updated: Utilities: Renamed the Output table Column Names in Minibatch DL
Date Tue, 12 Feb 2019 23:51:08 GMT
This is an automated email from the ASF dual-hosted git repository.

jingyimei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git


The following commit(s) were added to refs/heads/master by this push:
     new b8e1879  Utilities: Renamed the Output table Column Names in Minibatch DL
b8e1879 is described below

commit b8e18796605908504b12f36574bfc0681f6a8bf4
Author: Himanshu Pandey <hpandey@pivotal.io>
AuthorDate: Fri Feb 8 09:29:46 2019 -0800

    Utilities: Renamed the Output table Column Names in Minibatch DL
    
    JIRA: MADLIB-1300
    
    This commit renames the output table column names for minibatch DL, from
    dependent_varname/independent_varname to dependent_var/independent_var,
    because these columns contain values not names, and previous column name
    is misleading.
    
    Closes #351
---
 .../postgres/modules/utilities/minibatch_preprocessing.py_in | 11 +++++++++--
 .../modules/utilities/minibatch_preprocessing_dl.sql_in      |  4 ++--
 .../modules/utilities/test/minibatch_preprocessing_dl.sql_in | 12 ++++++------
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/ports/postgres/modules/utilities/minibatch_preprocessing.py_in b/src/ports/postgres/modules/utilities/minibatch_preprocessing.py_in
index be568a9..a4d1cba 100644
--- a/src/ports/postgres/modules/utilities/minibatch_preprocessing.py_in
+++ b/src/ports/postgres/modules/utilities/minibatch_preprocessing.py_in
@@ -51,6 +51,13 @@ m4_changequote(`<!', `!>')
 MINIBATCH_OUTPUT_DEPENDENT_COLNAME = "dependent_varname"
 MINIBATCH_OUTPUT_INDEPENDENT_COLNAME = "independent_varname"
 
+# These are readonly variables, do not modify
+#MADLIB-1300 Adding these variables for DL only at this time. 
+# For release 2.0 These will be removed and above variables can 
+# used for regular and DL minibatch. 
+MINIBATCH_OUTPUT_DEPENDENT_COLNAME_DL = "dependent_var"
+MINIBATCH_OUTPUT_INDEPENDENT_COLNAME_DL = "independent_var"
+
 class MiniBatchPreProcessorDL:
     def __init__(self, schema_madlib, source_table, output_table,
                  dependent_varname, independent_varname, buffer_size,
@@ -102,8 +109,8 @@ class MiniBatchPreProcessorDL:
                 GROUP BY buffer_id
             ) b
             {distributed_by_clause}
-        """.format(x=MINIBATCH_OUTPUT_INDEPENDENT_COLNAME,
-                   y=MINIBATCH_OUTPUT_DEPENDENT_COLNAME,
+        """.format(x=MINIBATCH_OUTPUT_INDEPENDENT_COLNAME_DL,
+                   y=MINIBATCH_OUTPUT_DEPENDENT_COLNAME_DL,
                    **locals())
         plpy.execute(sql)
         plpy.execute("DROP TABLE {0}".format(norm_tbl))
diff --git a/src/ports/postgres/modules/utilities/minibatch_preprocessing_dl.sql_in b/src/ports/postgres/modules/utilities/minibatch_preprocessing_dl.sql_in
index 994e458..0caca98 100644
--- a/src/ports/postgres/modules/utilities/minibatch_preprocessing_dl.sql_in
+++ b/src/ports/postgres/modules/utilities/minibatch_preprocessing_dl.sql_in
@@ -109,14 +109,14 @@ minibatch_preprocessor_dl(source_table,
         </td>
       </tr>
       <tr>
-        <th>dependent_varname</th>
+        <th>dependent_var</th>
         <td>ANYARRAY[]. Packed array of dependent variables. The type
         of the array is the same as the type of the dependent variable from
         the source table.
         </td>
       </tr>
       <tr>
-        <th>independent_varname</th>
+        <th>independent_var</th>
         <td>REAL[]. Packed array of independent variables.
         </td>
       </tr>
diff --git a/src/ports/postgres/modules/utilities/test/minibatch_preprocessing_dl.sql_in b/src/ports/postgres/modules/utilities/test/minibatch_preprocessing_dl.sql_in
index dd9b0d5..45da10f 100644
--- a/src/ports/postgres/modules/utilities/test/minibatch_preprocessing_dl.sql_in
+++ b/src/ports/postgres/modules/utilities/test/minibatch_preprocessing_dl.sql_in
@@ -51,10 +51,10 @@ SELECT minibatch_preprocessor_dl(
 SELECT assert(count(*)=4, 'Incorrect number of buffers in minibatch_preprocessor_dl_batch.')
 FROM minibatch_preprocessor_dl_batch;
 
-SELECT assert(array_upper(independent_varname, 1)=5, 'Incorrect buffer size.')
+SELECT assert(array_upper(independent_var, 1)=5, 'Incorrect buffer size.')
 FROM minibatch_preprocessor_dl_batch WHERE buffer_id=1;
 
-SELECT assert(array_upper(independent_varname, 1)=2, 'Incorrect buffer size.')
+SELECT assert(array_upper(independent_var, 1)=2, 'Incorrect buffer size.')
 FROM minibatch_preprocessor_dl_batch WHERE buffer_id=4;
 
 DROP TABLE IF EXISTS minibatch_preprocessor_dl_batch, minibatch_preprocessor_dl_batch_summary;
@@ -95,8 +95,8 @@ SELECT minibatch_preprocessor_dl(
   5);
 
 -- Test that indepdendent vars get divided by 5, by verifying min value goes from 1 to 0.2,
and max value from 233 to 46.6
-SELECT assert(relative_error(MIN(x),0.2) < 0.00001, 'Independent var not normalized properly!')
FROM (SELECT UNNEST(independent_varname) as x FROM minibatch_preprocessor_dl_batch) a;
-SELECT assert(relative_error(MAX(x),46.6) < 0.00001, 'Independent var not normalized properly!')
FROM (SELECT UNNEST(independent_varname) as x FROM minibatch_preprocessor_dl_batch) a;
+SELECT assert(relative_error(MIN(x),0.2) < 0.00001, 'Independent var not normalized properly!')
FROM (SELECT UNNEST(independent_var) as x FROM minibatch_preprocessor_dl_batch) a;
+SELECT assert(relative_error(MAX(x),46.6) < 0.00001, 'Independent var not normalized properly!')
FROM (SELECT UNNEST(independent_var) as x FROM minibatch_preprocessor_dl_batch) a;
 
 DROP TABLE IF EXISTS minibatch_preprocessor_dl_batch, minibatch_preprocessor_dl_batch_summary;
 SELECT minibatch_preprocessor_dl(
@@ -109,7 +109,7 @@ SELECT minibatch_preprocessor_dl(
   6);
 
 -- Test that dependent vars gets shifted by +6, by verifying minimum value goes from -6 to
0
-SELECT assert(abs(MIN(y))<0.00001, 'Dependent var not shifted properly!') FROM (SELECT
UNNEST(dependent_varname) as y FROM minibatch_preprocessor_dl_batch) a;
+SELECT assert(abs(MIN(y))<0.00001, 'Dependent var not shifted properly!') FROM (SELECT
UNNEST(dependent_var) as y FROM minibatch_preprocessor_dl_batch) a;
 
 DROP TABLE IF EXISTS minibatch_preprocessor_dl_batch, minibatch_preprocessor_dl_batch_summary;
 SELECT minibatch_preprocessor_dl(
@@ -122,4 +122,4 @@ SELECT minibatch_preprocessor_dl(
   -6);
 
 -- Test that dependent vars gets shifted by -6, by verifying minimum value goes from -6 to
-12
-SELECT assert(relative_error(MIN(y), -12)<0.00001, 'Dependent var not shifted properly!')
FROM (SELECT UNNEST(dependent_varname) as y FROM minibatch_preprocessor_dl_batch) a;
\ No newline at end of file
+SELECT assert(relative_error(MIN(y), -12)<0.00001, 'Dependent var not shifted properly!')
FROM (SELECT UNNEST(dependent_var) as y FROM minibatch_preprocessor_dl_batch) a;
\ No newline at end of file


Mime
View raw message