Bugfix: Install check for elastic net fails on gpdb5

MADLIB-1088

- Fixes concurrent delete issue with GPDB 5 on install check. This
also fixes the elastic net failure on cross validation, whose root
cause was drop and create table within the same query string.
- Fixes elastic net failure with IGD optimizer. Accessing warmup
lambdas was incorrect.

Closes #114


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

Branch: refs/heads/latest_release
Commit: f3b906e9d11c8e4894b3a0a8aa8d29cfb481025e
Parents: bb209bb
Author: Nandish Jayaram <njaya...@apache.org>
Authored: Tue Apr 11 15:45:33 2017 -0700
Committer: Nandish Jayaram <njaya...@apache.org>
Committed: Thu Apr 13 09:32:38 2017 -0700

----------------------------------------------------------------------
 src/ports/postgres/modules/elastic_net/elastic_net.py_in         | 2 --
 .../postgres/modules/elastic_net/elastic_net_optimizer_igd.py_in | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/f3b906e9/src/ports/postgres/modules/elastic_net/elastic_net.py_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/elastic_net/elastic_net.py_in 
b/src/ports/postgres/modules/elastic_net/elastic_net.py_in
index 762c473..fb46ba2 100644
--- a/src/ports/postgres/modules/elastic_net/elastic_net.py_in
+++ b/src/ports/postgres/modules/elastic_net/elastic_net.py_in
@@ -799,7 +799,6 @@ def elastic_net_predict_all(schema_madlib, tbl_model, 
tbl_new_source,
 
         if grouping_col and grouping_col != 'NULL':
             qstr = """
-                DROP TABLE IF EXISTS {tbl_predict};
                 CREATE TABLE {tbl_predict} AS
                     SELECT
                         {elastic_net_predict_id},
@@ -819,7 +818,6 @@ def elastic_net_predict_all(schema_madlib, tbl_model, 
tbl_new_source,
                 """.format(**locals())
         else:
             qstr = """
-            DROP TABLE IF EXISTS {tbl_predict};
             CREATE TABLE {tbl_predict} AS
                 SELECT
                     {elastic_net_predict_id},

http://git-wip-us.apache.org/repos/asf/incubator-madlib/blob/f3b906e9/src/ports/postgres/modules/elastic_net/elastic_net_optimizer_igd.py_in
----------------------------------------------------------------------
diff --git 
a/src/ports/postgres/modules/elastic_net/elastic_net_optimizer_igd.py_in 
b/src/ports/postgres/modules/elastic_net/elastic_net_optimizer_igd.py_in
index 5685af2..091aefb 100644
--- a/src/ports/postgres/modules/elastic_net/elastic_net_optimizer_igd.py_in
+++ b/src/ports/postgres/modules/elastic_net/elastic_net_optimizer_igd.py_in
@@ -251,7 +251,7 @@ def _elastic_net_igd_train_compute(schema_madlib, 
func_step_aggregate,
             'col_grp_state': unique_string(desp='col_grp_state'),
             'col_grp_key': unique_string(desp='col_grp_key'),
             'col_n_tuples': unique_string(desp='col_n_tuples'),
-            'lambda_count': 0,
+            'lambda_count': 1,
             'state_type': "double precision[]",
             'rel_source': tbl_used,
             'grouping_str': grouping_str,
@@ -282,7 +282,7 @@ def _elastic_net_igd_train_compute(schema_madlib, 
func_step_aggregate,
                                      dimension=args["dimension"],
                                      stepsize=args["stepsize"],
                                      lambda_name=args["warmup_lambdas"],
-                                     
warmup_lambda_value=args.get('warmup_lambdas')[args["lambda_count"]],
+                                     
warmup_lambda_value=args.get('warmup_lambdas')[args["lambda_count"]-1],
                                      alpha=args["alpha"],
                                      row_num=args["row_num"],
                                      xmean_val=args["xmean_val"],

Reply via email to