You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by ok...@apache.org on 2018/06/26 18:31:14 UTC

[5/5] madlib git commit: Madpack: Add dev-check and a compact install-check.

Madpack: Add dev-check and a compact install-check.

JIRA: MADLIB-1247

- The current install check is expensive since it runs various hyper param
permutations for all MADlib modules. This commits moves all of those
tests to dev-check, which can be used by developers for iterating
faster. We have now created watered down install-check for each module,
which just runs one  hyper-param combination for each MADlib function,
and does not do any asserts.
- This commit also includes changes in madpack to add a new madpack
option for dev-check.

Co-authored-by: Nandish Jayaram <nj...@apache.org>
Co-authored-by: Arvind Sridhar <as...@pivotal.io>


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

Branch: refs/heads/master
Commit: 4ed8b35e031f301f150b6f2d153aa1d08c7b3e16
Parents: b8031a0
Author: Orhan Kislal <ok...@apache.org>
Authored: Tue Jun 26 10:54:15 2018 -0700
Committer: Arvind Sridhar <as...@pivotal.io>
Committed: Tue Jun 26 11:30:52 2018 -0700

----------------------------------------------------------------------
 pom.xml                                         |   2 +-
 src/madpack/madpack.py                          |  79 +-
 .../assoc_rules/test/assoc_rules.ic.sql_in      | 148 ++++
 .../postgres/modules/bayes/test/bayes.ic.sql_in | 105 +++
 .../conjugate_gradient/test/conj_grad.ic.sql_in |  65 ++
 .../postgres/modules/convex/test/lmf.ic.sql_in  |  56 ++
 .../postgres/modules/convex/test/mlp.ic.sql_in  |  92 ++
 .../modules/crf/test/crf_test_small.ic.sql_in   | 130 +++
 .../modules/crf/test/crf_train_small.ic.sql_in  |  83 ++
 .../elastic_net/test/elastic_net.ic.sql_in      | 194 +++++
 .../modules/elastic_net/test/elastic_net.sql_in | 842 +++++++++++++++++++
 .../test/elastic_net_install_check.sql_in       | 842 -------------------
 .../postgres/modules/glm/test/glm.ic.sql_in     | 364 ++++++++
 .../postgres/modules/graph/test/graph.ic.sql_in | 116 +++
 .../modules/kmeans/test/kmeans.ic.sql_in        |  54 ++
 .../postgres/modules/knn/test/knn.ic.sql_in     |  58 ++
 .../postgres/modules/lda/test/lda.ic.sql_in     |  95 +++
 .../modules/linalg/test/linalg.ic.sql_in        | 125 +++
 .../modules/linalg/test/matrix_ops.ic.sql_in    | 121 +++
 .../postgres/modules/linalg/test/svd.ic.sql_in  |  47 ++
 .../test/dense_linear_sytems.ic.sql_in          |  50 ++
 .../test/sparse_linear_sytems.ic.sql_in         |  64 ++
 .../postgres/modules/pca/test/pca.ic.sql_in     |  52 ++
 .../modules/pca/test/pca_project.ic.sql_in      |  79 ++
 .../postgres/modules/prob/test/prob.ic.sql_in   |  44 +
 .../test/decision_tree.ic.sql_in                |  70 ++
 .../test/random_forest.ic.sql_in                |  66 ++
 .../modules/regress/test/clustered.ic.sql_in    |  48 ++
 .../modules/regress/test/linear.ic.sql_in       |  56 ++
 .../modules/regress/test/logistic.ic.sql_in     |  59 ++
 .../modules/regress/test/marginal.ic.sql_in     |  69 ++
 .../regress/test/multilogistic.ic.sql_in        |  61 ++
 .../modules/regress/test/robust.ic.sql_in       |  62 ++
 .../sample/test/balance_sample.ic.sql_in        |  43 +
 .../modules/sample/test/sample.ic.sql_in        |  33 +
 .../sample/test/stratified_sample.ic.sql_in     |  42 +
 .../sample/test/train_test_split.ic.sql_in      |  43 +
 .../modules/stats/test/anova_test.ic.sql_in     |  49 ++
 .../modules/stats/test/chi2_test.ic.sql_in      |  42 +
 .../modules/stats/test/correlation.ic.sql_in    |  35 +
 .../stats/test/cox_prop_hazards.ic.sql_in       |  51 ++
 .../modules/stats/test/f_test.ic.sql_in         |  82 ++
 .../modules/stats/test/ks_test.ic.sql_in        |  43 +
 .../modules/stats/test/mw_test.ic.sql_in        |  54 ++
 .../modules/stats/test/pred_metrics.ic.sql_in   |  56 ++
 ...obust_and_clustered_variance_coxph.ic.sql_in |  57 ++
 .../modules/stats/test/t_test.ic.sql_in         |  45 +
 .../modules/stats/test/wsr_test.ic.sql_in       |  45 +
 .../modules/summary/test/summary.ic.sql_in      |  34 +
 .../postgres/modules/svm/test/svm.ic.sql_in     |  46 +
 .../postgres/modules/tsa/test/arima.ic.sql_in   |  53 ++
 .../utilities/test/drop_madlib_temp.ic.sql_in   |  23 +
 .../utilities/test/encode_categorical.ic.sql_in |  47 ++
 .../test/minibatch_preprocessing.ic.sql_in      |  50 ++
 .../modules/utilities/test/path.ic.sql_in       |  59 ++
 .../modules/utilities/test/pivot.ic.sql_in      |  44 +
 .../modules/utilities/test/sessionize.ic.sql_in |  51 ++
 .../utilities/test/text_utilities.ic.sql_in     |  53 ++
 .../validation/test/cross_validation.ic.sql_in  |  64 ++
 59 files changed, 4773 insertions(+), 869 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0a059ab..0015f06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -488,7 +488,7 @@
               <exclude>src/ports/postgres/modules/elastic_net/elastic_net_optimizer_fista.py_in</exclude>
               <exclude>src/ports/postgres/modules/elastic_net/elastic_net_optimizer_igd.py_in</exclude>
               <exclude>src/ports/postgres/modules/elastic_net/elastic_net_utils.py_in</exclude>
-              <exclude>src/ports/postgres/modules/elastic_net/test/elastic_net_install_check.sql_in</exclude>
+              <exclude>src/ports/postgres/modules/elastic_net/test/elastic_net.sql_in</exclude>
               <exclude>src/ports/postgres/modules/glm/__init__.py_in</exclude>
               <exclude>src/ports/postgres/modules/glm/glm.py_in</exclude>
               <exclude>src/ports/postgres/modules/glm/glm.sql_in</exclude>

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/madpack/madpack.py
----------------------------------------------------------------------
diff --git a/src/madpack/madpack.py b/src/madpack/madpack.py
index a12a8e3..4f3c9ef 100755
--- a/src/madpack/madpack.py
+++ b/src/madpack/madpack.py
@@ -770,10 +770,11 @@ def parse_arguments():
                   uninstall      : run sql scripts to uninstall from DB
                   reinstall      : performs uninstall and install
                   version        : compare and print MADlib version (binaries vs database objects)
-                  install-check  : test all installed modules
+                  install-check  : sanity run of all installed modules
+                  dev-check      : test all installed modules
                   """
     choice_list = ['install', 'update', 'upgrade', 'uninstall',
-                   'reinstall', 'version', 'install-check']
+                   'reinstall', 'version', 'install-check', 'dev-check']
 
     parser.add_argument('command', metavar='COMMAND', nargs=1,
                         choices=choice_list, help=help_msg)
@@ -812,7 +813,8 @@ def parse_arguments():
     # Get the arguments
     return parser.parse_args()
 
-def run_install_check(args, testcase):
+def run_install_check(args, testcase, madpack_cmd):
+    is_install_check = True if madpack_cmd == 'install-check' else False
     schema = args['schema']
     db_madlib_ver = args['db_madlib_ver']
     # 1) Compare OS and DB versions. Continue if OS = DB.
@@ -859,26 +861,6 @@ def run_install_check(args, testcase):
             # Get module name
             module = moduleinfo['name']
 
-            # Skip if doesn't meet specified modules
-            if modset is not None and len(modset) > 0 and module not in modset:
-                continue
-            # JIRA: MADLIB-1078 fix
-            # Skip pmml during install-check (when run without the -t option).
-            # We can still run install-check on pmml with '-t' option.
-            if not modset and module in ['pmml']:
-                continue
-            info_(this, "> - %s" % module, verbose)
-
-            # Make a temp dir for this module (if doesn't exist)
-            cur_tmpdir = tmpdir + '/' + module + '/test'  # tmpdir is a global variable
-            _make_dir(cur_tmpdir)
-
-            # Find the Python module dir (platform specific or generic)
-            if os.path.isdir(maddir + "/ports/" + portid + "/" + dbver + "/modules/" + module):
-                maddir_mod_py = maddir + "/ports/" + portid + "/" + dbver + "/modules"
-            else:
-                maddir_mod_py = maddir + "/modules"
-
             # Find the SQL module dir (platform specific or generic)
             if os.path.isdir(maddir + "/ports/" + portid + "/modules/" + module):
                 maddir_mod_sql = maddir + "/ports/" + portid + "/modules"
@@ -900,13 +882,58 @@ def run_install_check(args, testcase):
                       % (test_user, test_schema, schema)
 
             # Loop through all test SQL files for this module
-            sql_files = maddir_mod_sql + '/' + module + '/test/*.sql_in'
+            if is_install_check:
+                sql_files = maddir_mod_sql + '/' + module + '/test/*.ic.sql_in'
+            else:
+                sql_files = maddir_mod_sql + '/' + module + '/test/*[!ic].sql_in'
             for sqlfile in sorted(glob.glob(sql_files), reverse=True):
                 algoname = os.path.basename(sqlfile).split('.')[0]
                 # run only algo specified
                 if (module in modset and modset[module] and
                         algoname not in modset[module]):
                     continue
+                # JIRA: MADLIB-1078 fix
+                # Skip pmml during install-check (when run without the -t option).
+                # We can still run install-check on pmml with '-t' option.
+                if not modset and module in ['pmml']:
+                    continue
+                info_(this, "> - %s" % module, verbose)
+
+                # Make a temp dir for this module (if doesn't exist)
+                cur_tmpdir = tmpdir + '/' + module + '/test'  # tmpdir is a global variable
+                _make_dir(cur_tmpdir)
+
+                # Find the Python module dir (platform specific or generic)
+                if os.path.isdir(maddir + "/ports/" + portid + "/" + dbver + "/modules/" + module):
+                    maddir_mod_py = maddir + "/ports/" + portid + "/" + dbver + "/modules"
+                else:
+                    maddir_mod_py = maddir + "/modules"
+
+                # Find the SQL module dir (platform specific or generic)
+                if os.path.isdir(maddir + "/ports/" + portid + "/modules/" + module):
+                    maddir_mod_sql = maddir + "/ports/" + portid + "/modules"
+                else:
+                    maddir_mod_sql = maddir + "/modules"
+
+                # Prepare test schema
+                test_schema = "madlib_installcheck_%s" % (module)
+                _internal_run_query("DROP SCHEMA IF EXISTS %s CASCADE; CREATE SCHEMA %s;" %
+                                    (test_schema, test_schema), True)
+                _internal_run_query("GRANT ALL ON SCHEMA %s TO %s;" %
+                                    (test_schema, test_user), True)
+
+                # Switch to test user and prepare the search_path
+                pre_sql = '-- Switch to test user:\n' \
+                          'SET ROLE %s;\n' \
+                          '-- Set SEARCH_PATH for install-check:\n' \
+                          'SET search_path=%s,%s;\n' \
+                          % (test_user, test_schema, schema)
+
+                algoname = os.path.basename(sqlfile).split('.')[0]
+                # run only algo specified
+                if (module in modset and modset[module] and
+                        algoname not in modset[module]):
+                    continue
 
                 # Set file names
                 tmpfile = cur_tmpdir + '/' + os.path.basename(sqlfile) + '.tmp'
@@ -1241,8 +1268,8 @@ def main(argv):
         _print_vers(new_madlib_ver, db_madlib_ver, con_args, schema)
 
     # COMMAND: install-check
-    if args.command[0] == 'install-check':
-        run_install_check(locals(), args.testcase)
+    if args.command[0] in ('install-check', 'dev-check'):
+        run_install_check(locals(), args.testcase, args.command[0])
     else:
         try:
             is_schema_in_db = _internal_run_query("SELECT schema_name FROM information_schema.schemata WHERE schema_name='%s';" % schema, True)

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/assoc_rules/test/assoc_rules.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/assoc_rules/test/assoc_rules.ic.sql_in b/src/ports/postgres/modules/assoc_rules/test/assoc_rules.ic.sql_in
new file mode 100644
index 0000000..581aa60
--- /dev/null
+++ b/src/ports/postgres/modules/assoc_rules/test/assoc_rules.ic.sql_in
@@ -0,0 +1,148 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+---------------------------------------------------------------------------
+-- Rules:
+-- ------
+-- 1) Any DB objects should be created w/o schema prefix,
+--    since this file is executed in a separate schema context.
+-- 2) There should be no DROP statements in this script, since
+--    all objects created in the default schema will be cleaned-up outside.
+---------------------------------------------------------------------------
+
+---------------------------------------------------------------------------
+-- Setup:
+---------------------------------------------------------------------------
+CREATE OR REPLACE FUNCTION assoc_array_eq
+    (
+    arr1 TEXT[],
+    arr2 TEXT[]
+    )
+RETURNS BOOL AS $$
+    SELECT COUNT(*) = array_upper($1, 1) AND array_upper($1, 1) = array_upper($2, 1)
+    FROM (SELECT unnest($1) id) t1, (SELECT unnest($2) id) t2
+    WHERE t1.id = t2.id;
+
+$$ LANGUAGE sql IMMUTABLE;
+
+
+CREATE OR REPLACE FUNCTION install_test() RETURNS VOID AS $$
+declare
+    result1        TEXT;
+    result2        TEXT;
+    result3        TEXT;
+    result_maxiter TEXT;
+    res            MADLIB_SCHEMA.assoc_rules_results;
+    output_schema  TEXT;
+    output_table   TEXT;
+    total_rules    INT;
+    total_time     INTERVAL;
+begin
+    DROP TABLE IF EXISTS test_data1;
+    CREATE TABLE test_data1 (
+        trans_id INT
+        , product INT
+    );
+
+    DROP TABLE IF EXISTS test_data2;
+    CREATE TABLE test_data2 (
+        trans_id INT
+        , product VARCHAR
+    );
+
+
+    INSERT INTO test_data1 VALUES (1,1);
+    INSERT INTO test_data1 VALUES (1,2);
+    INSERT INTO test_data1 VALUES (3,3);
+    INSERT INTO test_data1 VALUES (8,4);
+    INSERT INTO test_data1 VALUES (10,1);
+    INSERT INTO test_data1 VALUES (10,2);
+    INSERT INTO test_data1 VALUES (10,3);
+    INSERT INTO test_data1 VALUES (19,2);
+
+    INSERT INTO test_data2 VALUES (1, 'beer');
+    INSERT INTO test_data2 VALUES (1, 'diapers');
+    INSERT INTO test_data2 VALUES (1, 'chips');
+    INSERT INTO test_data2 VALUES (2, 'beer');
+    INSERT INTO test_data2 VALUES (2, 'diapers');
+    INSERT INTO test_data2 VALUES (3, 'beer');
+    INSERT INTO test_data2 VALUES (3, 'diapers');
+    INSERT INTO test_data2 VALUES (4, 'beer');
+    INSERT INTO test_data2 VALUES (4, 'chips');
+    INSERT INTO test_data2 VALUES (5, 'beer');
+    INSERT INTO test_data2 VALUES (6, 'beer');
+    INSERT INTO test_data2 VALUES (6, 'diapers');
+    INSERT INTO test_data2 VALUES (6, 'chips');
+    INSERT INTO test_data2 VALUES (7, 'beer');
+    INSERT INTO test_data2 VALUES (7, 'diapers');
+
+    DROP TABLE IF EXISTS test1_exp_result;
+    CREATE TABLE test1_exp_result (
+        ruleid integer,
+        pre text[],
+        post text[],
+        support double precision,
+        confidence double precision,
+        lift double precision,
+        conviction double precision
+    ) ;
+
+    DROP TABLE IF EXISTS test2_exp_result;
+    CREATE TABLE test2_exp_result (
+        ruleid integer,
+        pre text[],
+        post text[],
+        support double precision,
+        confidence double precision,
+        lift double precision,
+        conviction double precision
+    ) ;
+
+
+    INSERT INTO test1_exp_result VALUES (7, '{3}', '{1}', 0.20000000000000001, 0.5, 1.2499999999999998, 1.2);
+    INSERT INTO test1_exp_result VALUES (4, '{2}', '{1}', 0.40000000000000002, 0.66666666666666674, 1.6666666666666667, 1.8000000000000003);
+    INSERT INTO test1_exp_result VALUES (1, '{1}', '{2,3}', 0.20000000000000001, 0.5, 2.4999999999999996, 1.6000000000000001);
+    INSERT INTO test1_exp_result VALUES (9, '{2,3}', '{1}', 0.20000000000000001, 1, 2.4999999999999996, 0);
+    INSERT INTO test1_exp_result VALUES (6, '{1,2}', '{3}', 0.20000000000000001, 0.5, 1.2499999999999998, 1.2);
+    INSERT INTO test1_exp_result VALUES (8, '{3}', '{2}', 0.20000000000000001, 0.5, 0.83333333333333337, 0.80000000000000004);
+    INSERT INTO test1_exp_result VALUES (5, '{1}', '{2}', 0.40000000000000002, 1, 1.6666666666666667, 0);
+    INSERT INTO test1_exp_result VALUES (2, '{3}', '{2,1}', 0.20000000000000001, 0.5, 1.2499999999999998, 1.2);
+    INSERT INTO test1_exp_result VALUES (10, '{3,1}', '{2}', 0.20000000000000001, 1, 1.6666666666666667, 0);
+    INSERT INTO test1_exp_result VALUES (3, '{1}', '{3}', 0.20000000000000001, 0.5, 1.2499999999999998, 1.2);
+
+    INSERT INTO test2_exp_result VALUES (7, '{chips,diapers}', '{beer}', 0.2857142857142857, 1, 1, 0);
+    INSERT INTO test2_exp_result VALUES (2, '{chips}', '{diapers}', 0.2857142857142857, 0.66666666666666663, 0.93333333333333324, 0.85714285714285698);
+    INSERT INTO test2_exp_result VALUES (1, '{chips}', '{diapers,beer}', 0.2857142857142857, 0.66666666666666663, 0.93333333333333324, 0.85714285714285698);
+    INSERT INTO test2_exp_result VALUES (6, '{diapers}', '{beer}', 0.7142857142857143, 1, 1, 0);
+    INSERT INTO test2_exp_result VALUES (4, '{beer}', '{diapers}', 0.7142857142857143, 0.7142857142857143, 1, 1);
+    INSERT INTO test2_exp_result VALUES (3, '{chips,beer}', '{diapers}', 0.2857142857142857, 0.66666666666666663, 0.93333333333333324, 0.85714285714285698);
+    INSERT INTO test2_exp_result VALUES (5, '{chips}', '{beer}', 0.42857142857142855, 1, 1, 0);
+
+    res = MADLIB_SCHEMA.assoc_rules (.1, .5, 'trans_id', 'product', 'test_data1','madlib_installcheck_assoc_rules', false);
+
+    RETURN;
+
+end $$ language plpgsql;
+
+---------------------------------------------------------------------------
+-- Test
+---------------------------------------------------------------------------
+SELECT install_test();

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/bayes/test/bayes.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/bayes/test/bayes.ic.sql_in b/src/ports/postgres/modules/bayes/test/bayes.ic.sql_in
new file mode 100644
index 0000000..86a5ce2
--- /dev/null
+++ b/src/ports/postgres/modules/bayes/test/bayes.ic.sql_in
@@ -0,0 +1,105 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+---------------------------------------------------------------------------
+-- Rules:
+-- ------
+-- 1) Any DB objects should be created w/o schema prefix,
+--    since this file is executed in a separate schema context.
+-- 2) There should be no DROP statements in this script, since
+--    all objects created in the default schema will be cleaned-up outside.
+---------------------------------------------------------------------------
+
+---------------------------------------------------------------------------
+-- Setup:
+---------------------------------------------------------------------------
+CREATE OR REPLACE FUNCTION fill_feature(pre_class INT, p FLOAT, total INT)
+RETURNS FLOAT AS $$
+declare
+	result FLOAT;
+	thres INT;
+begin
+	thres = total*p;
+
+	IF pre_class <= thres THEN
+		result = 1;
+	ELSE
+		result = 0;
+	END IF;
+	RETURN result;
+end
+$$ language plpgsql;
+
+-- ----------------
+-- install_test_1()
+-- ----------------
+CREATE FUNCTION install_test_1() RETURNS VOID AS $$
+declare
+	num1 INT := 10;
+	num2 INT := 10;
+
+	result1 INT;
+	count1 INT;
+	tempvar INT[];
+
+begin
+	-- prepare training data: equal priors
+	--DROP TABLE IF EXISTS data CASCADE;
+	CREATE TABLE data_1( class INT, attrib FLOAT[] );
+	INSERT INTO data_1 SELECT 1, ARRAY[fill_feature(id,0.3,num1),fill_feature(id,0.8,num1)] FROM generate_series(1,num1) as id;
+	INSERT INTO data_1 SELECT 2, ARRAY[fill_feature(id,0.5,num2),fill_feature(id,0.5,num2)] FROM generate_series(1,num2) as id;
+
+	-- prepare testing data
+	--DROP TABLE IF EXISTS data_test CASCADE;
+	CREATE TABLE data_test_1( id INT, attrib INT[], prob FLOAT[] );
+	INSERT INTO data_test_1 VALUES (1,'{0,0}','{0.4,0.6}');
+	INSERT INTO data_test_1 VALUES (2,'{0,1}','{0.66666,0.33333}');
+	INSERT INTO data_test_1 VALUES (3,'{1,0}','{0.25,0.75}');
+	INSERT INTO data_test_1 VALUES (4,'{1,1}','{0.5,0.5}');
+
+	-- prepare true results for testing data
+	--DROP TABLE IF EXISTS data_results;
+	CREATE TABLE data_results_1 AS
+		SELECT
+			id,
+			unnest('{1,2}'::INT[]) as class,
+			unnest(prob) as prob
+		FROM data_test_1;
+
+	-- Process training
+	--DROP TABLE IF EXISTS probs CASCADE;
+	--DROP TABLE IF EXISTS priors CASCADE;
+	PERFORM MADLIB_SCHEMA.create_nb_prepared_data_tables('data_1','class','attrib',2,'probs','priors');
+	-- Classify
+	--DROP VIEW IF EXISTS results;
+	PERFORM MADLIB_SCHEMA.create_nb_classify_view('probs','priors','data_test_1','id','attrib',2,'results_1');
+	-- Compute posteriors
+	--DROP VIEW IF EXISTS probs_view;
+	PERFORM MADLIB_SCHEMA.create_nb_probs_view('probs','priors','data_test_1','id','attrib',2,'probs_view_1');
+
+
+end
+$$ language plpgsql;
+
+---------------------------------------------------------------------------
+-- Test:
+---------------------------------------------------------------------------
+SELECT install_test_1();

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/conjugate_gradient/test/conj_grad.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/conjugate_gradient/test/conj_grad.ic.sql_in b/src/ports/postgres/modules/conjugate_gradient/test/conj_grad.ic.sql_in
new file mode 100644
index 0000000..50ee25b
--- /dev/null
+++ b/src/ports/postgres/modules/conjugate_gradient/test/conj_grad.ic.sql_in
@@ -0,0 +1,65 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+---------------------------------------------------------------------------
+-- Rules:
+-- ------
+-- 1) Any DB objects should be created w/o schema prefix,
+--    since this file is executed in a separate schema context.
+-- 2) There should be no DROP statements in this script, since
+--    all objects created in the default schema will be cleaned-up outside.
+---------------------------------------------------------------------------
+
+---------------------------------------------------------------------------
+-- Setup:
+---------------------------------------------------------------------------
+CREATE FUNCTION install_test() RETURNS VOID AS $$
+declare
+	result float;
+	x FLOAT[];
+
+begin
+	CREATE TABLE A(
+		row INT,
+		val FLOAT[]
+	);
+
+	INSERT INTO A VALUES(1, ARRAY[1.0175001, 0.45604107, 0.32282152, 0.25168270, 0.20694042, 0.17602822, 0.15331823, 0.13589278, 0.12208089, 0.11085359]);
+	INSERT INTO A VALUES(2, ARRAY[0.4560411, 0.48234387, 0.21190993, 0.17177051, 0.14528005, 0.12627935, 0.11189286, 0.10057578, 0.09141562, 0.08383503]);
+	INSERT INTO A VALUES(3, ARRAY[0.3228215, 0.21190993, 0.36372483, 0.13511499, 0.11570299, 0.10149569, 0.09057135, 0.08187212, 0.07476054, 0.06882649]);
+	INSERT INTO A VALUES(4, ARRAY[0.2516827, 0.17177051, 0.13511499, 0.31270305, 0.09720943, 0.08572070, 0.07680054, 0.06964365, 0.06375766, 0.05882206]);
+	INSERT INTO A VALUES(5, ARRAY[0.2069404, 0.14528005, 0.11570299, 0.09720943, 0.28424848, 0.07454783, 0.06696472, 0.06084900, 0.05579869, 0.05154975]);
+	INSERT INTO A VALUES(6, ARRAY[0.1760282, 0.12627935, 0.10149569, 0.08572070, 0.07454783, 0.26612646, 0.05951006, 0.05415360, 0.04971703, 0.04597544]);
+	INSERT INTO A VALUES(7, ARRAY[0.1533182, 0.11189286, 0.09057135, 0.07680054, 0.06696472, 0.05951006, 0.25363014, 0.04885589, 0.04489247, 0.04154376]);
+	INSERT INTO A VALUES(8, ARRAY[0.1358928, 0.10057578, 0.08187212, 0.06964365, 0.06084900, 0.05415360, 0.04885589, 0.24454426, 0.04095839, 0.03792426]);
+	INSERT INTO A VALUES(9, ARRAY[0.1220809, 0.09141562, 0.07476054, 0.06375766, 0.05579869, 0.04971703, 0.04489247, 0.04095839, 0.23768165, 0.03490583]);
+	INSERT INTO A VALUES(10,ARRAY[0.1108536, 0.08383503, 0.06882649, 0.05882206, 0.05154975, 0.04597544, 0.04154376, 0.03792426, 0.03490583, 0.23234632]);
+
+	SELECT INTO x MADLIB_SCHEMA.conjugate_gradient('A', 'val', 'row', ARRAY(SELECT random() FROM generate_series(1,10)), .000001,2);
+	result = x[1]*x[1];
+	RETURN;
+end
+$$ language plpgsql;
+
+---------------------------------------------------------------------------
+-- Test
+---------------------------------------------------------------------------
+SELECT install_test();

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/convex/test/lmf.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/convex/test/lmf.ic.sql_in b/src/ports/postgres/modules/convex/test/lmf.ic.sql_in
new file mode 100644
index 0000000..ede53e4
--- /dev/null
+++ b/src/ports/postgres/modules/convex/test/lmf.ic.sql_in
@@ -0,0 +1,56 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+/* -----------------------------------------------------------------------------
+ * Test Low-rank Matrix Factorization
+ * -------------------------------------------------------------------------- */
+
+CREATE TABLE "Mlens" (
+    id serial,
+    "User_id" integer,
+    "Movie_id" integer,
+    "Rating" double precision
+);
+
+COPY "Mlens" ("User_id", "Movie_id", "Rating") FROM stdin DELIMITER ',';
+22,377,1
+6,86,3
+62,257,2
+95,546,2
+38,95,5
+13,225,4
+12,203,3
+\.
+
+SELECT lmf_igd_run(
+    'test_lmf_model',
+    '"Mlens"',
+    '"User_id"',
+    '"Movie_id"',
+    '"Rating"',
+    943,        -- row_dim
+    1682,       -- col_dim
+    2,          -- max_rank
+    0.03,       -- stepsize
+    0.1,        -- init_value
+    5,          -- num_iterations
+    1e-3        -- tolerance
+    );

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/convex/test/mlp.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/convex/test/mlp.ic.sql_in b/src/ports/postgres/modules/convex/test/mlp.ic.sql_in
new file mode 100644
index 0000000..0d8a116
--- /dev/null
+++ b/src/ports/postgres/modules/convex/test/mlp.ic.sql_in
@@ -0,0 +1,92 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+-- NOTE that the batch specific tables were created using:
+-- madlib.minibatch_preprocessor(), with the regular source tables used in
+-- this file.
+
+-- Create preprocessed data that can be used with minibatch MLP:
+DROP TABLE IF EXISTS iris_data_batch, iris_data_batch_summary, iris_data_batch_standardization;
+CREATE TABLE iris_data_batch(
+    __id__ integer,
+    dependent_varname double precision[],
+    independent_varname double precision[]
+);
+COPY iris_data_batch (__id__, dependent_varname, independent_varname) FROM STDIN NULL '?' DELIMITER '|';
+0 | {{0,1,0},{0,1,0},{0,0,1},{1,0,0},{0,1,0},{0,1,0},{0,0,1},{1,0,0},{1,0,0},{0,1,0},{1,0,0},{0,0,1},{0,0,1},{0,0,1},{1,0,0},{0,0,1},{0,0,1},{1,0,0},{1,0,0},{0,0,1},{0,1,0},{0,0,1},{0,0,1},{0,0,1},{0,0,1},{1,0,0},{0,1,0},{0,0,1},{0,0,1},{1,0,0}} | {{0.828881825720994,-0.314980522532101,0.363710790466334,0.159758615207397},{-1.08079689039279,-1.57669227467446,-0.229158821743702,-0.240110581430527},{-1.08079689039279,-1.32434992424599,0.482284712908341,0.692917544057962},{-1.46273263361555,0.442046528753317,-1.35561108494277,-1.30642843913166},{-0.0623015751321059,-0.567322872960574,0.245136868024327,0.159758615207397},{-0.189613489539692,-0.819665223389045,0.304423829245331,0.159758615207397},{0.701569911313408,-1.32434992424599,0.778719519013359,0.959497008483245},{-1.20810880480038,-0.0626381721036282,-1.35561108494277,-1.4397181713443},{-0.698861147170034,0.946731229610261,-1.35561108494277,-1.30642843913166},{-0.82617306157762,-1.32434992424599,-0.407019705406713,-0.1068208492178
 86},{-0.698861147170034,2.71312768260957,-1.29632412372177,-1.4397181713443},{1.33812948335134,0.442046528753317,1.31230217000239,1.49265593733381},{0.319634168090651,-0.0626381721036282,0.660145596571352,0.826207276270604},{0.701569911313408,-1.32434992424599,0.778719519013359,0.959497008483245},{-0.698861147170034,1.19907358003873,-1.29632412372177,-1.30642843913166},{1.46544139775892,0.189704178324845,0.838006480234363,1.49265593733381},{1.21081756894375,-0.0626381721036282,0.897293441455367,1.49265593733381},{-0.444237318354863,1.70375828089568,-1.29632412372177,-1.30642843913166},{-0.82617306157762,1.95610063132415,-1.05917627883775,-1.03984897470638},{0.828881825720994,-0.819665223389045,0.95658040267637,0.959497008483245},{0.956193740128579,-0.567322872960574,0.541571674129345,0.42633807963268},{1.33812948335134,0.442046528753317,1.31230217000239,1.49265593733381},{0.574257996905822,0.946731229610261,1.01586736389737,1.49265593733381},{0.0650103392754793,-0.819665223389045,0.
 838006480234363,0.959497008483245},{0.0650103392754793,-0.819665223389045,0.838006480234363,0.959497008483245},{-1.46273263361555,0.442046528753317,-1.35561108494277,-1.30642843913166},{0.574257996905822,-2.08137697553141,0.482284712908341,0.42633807963268},{1.21081756894375,0.189704178324845,1.13444128633938,1.62594566954645},{1.97468905538926,-0.314980522532101,1.54945001488641,0.826207276270604},{-1.08079689039279,0.189704178324845,-1.29632412372177,-1.4397181713443}}
+1 | {{0,1,0},{1,0,0},{0,1,0},{1,0,0},{1,0,0},{1,0,0},{1,0,0},{0,1,0},{0,0,1},{0,0,1},{1,0,0},{0,0,1},{1,0,0},{0,0,1},{0,1,0},{0,1,0},{0,1,0},{1,0,0},{1,0,0},{0,0,1},{0,1,0},{0,1,0},{0,0,1},{1,0,0},{1,0,0},{0,1,0},{1,0,0},{0,0,1},{0,1,0},{0,1,0}} | {{-0.0623015751321059,-0.0626381721036282,0.304423829245331,0.0264688829947554},{-0.316925403947277,2.96547003303804,-1.35561108494277,-1.30642843913166},{0.319634168090651,-0.819665223389045,0.838006480234363,0.559627811845321},{-0.953484975985206,1.19907358003873,-1.41489804616377,-1.17313870691902},{-0.953484975985206,0.442046528753317,-1.47418500738478,-1.30642843913166},{-1.33542071920796,0.442046528753317,-1.41489804616377,-1.30642843913166},{-1.71735646243072,-0.0626381721036282,-1.41489804616377,-1.30642843913166},{0.446946082498236,-0.0626381721036282,0.541571674129345,0.293048347420038},{1.21081756894375,-1.32434992424599,1.25301520878139,0.826207276270604},{0.701569911313408,0.694388879181789,1.3715891312234,1.75923540175909},{-
 1.84466837683831,-0.0626381721036282,-1.53347196860578,-1.4397181713443},{1.84737714098168,1.45141593046721,1.4308760924444,1.75923540175909},{-0.82617306157762,1.19907358003873,-1.35561108494277,-1.30642843913166},{0.701569911313408,-0.314980522532101,1.13444128633938,0.826207276270604},{1.33812948335134,-0.567322872960574,0.660145596571352,0.293048347420038},{0.192322253683066,-0.0626381721036282,0.304423829245331,0.42633807963268},{-0.189613489539692,-0.819665223389045,0.304423829245331,0.159758615207397},{-1.46273263361555,0.189704178324845,-1.29632412372177,-1.30642843913166},{-1.71735646243072,0.442046528753317,-1.41489804616377,-1.30642843913166},{0.828881825720994,0.189704178324845,1.07515432511838,0.826207276270604},{0.0650103392754793,-1.07200757381752,0.185849906803323,0.0264688829947554},{-0.953484975985206,-2.58606167638835,-0.110584899301695,-0.240110581430527},{0.192322253683066,-0.0626381721036282,0.838006480234363,0.826207276270604},{-0.953484975985206,1.19907358003
 873,-1.23703716250076,-0.773269510281093},{-0.82617306157762,0.946731229610261,-1.29632412372177,-1.30642843913166},{0.319634168090651,0.946731229610261,0.482284712908341,0.559627811845321},{-0.953484975985206,0.694388879181789,-1.35561108494277,-1.30642843913166},{0.192322253683066,-0.0626381721036282,0.838006480234363,0.826207276270604},{0.446946082498236,-0.314980522532101,0.600858635350349,0.293048347420038},{-0.0623015751321059,-0.567322872960574,0.482284712908341,0.159758615207397}}
+2 | {{1,0,0},{1,0,0},{0,0,1},{1,0,0},{0,1,0},{0,1,0},{1,0,0},{1,0,0},{0,0,1},{0,0,1},{0,1,0},{0,1,0},{0,1,0},{0,1,0},{1,0,0},{0,0,1},{0,1,0},{1,0,0},{1,0,0},{0,0,1},{1,0,0},{0,0,1},{1,0,0},{1,0,0},{1,0,0},{1,0,0},{0,1,0},{1,0,0},{0,1,0},{0,0,1}} | {{-0.953484975985206,0.946731229610261,-1.23703716250076,-1.03984897470638},{-0.953484975985206,0.694388879181789,-1.35561108494277,-1.30642843913166},{1.21081756894375,0.694388879181789,1.19372824756038,1.75923540175909},{-1.20810880480038,0.946731229610261,-1.23703716250076,-1.30642843913166},{1.08350565453616,-0.314980522532101,0.541571674129345,0.159758615207397},{-0.189613489539692,-0.314980522532101,-0.0512979380806911,0.159758615207397},{-1.20810880480038,-0.0626381721036282,-1.35561108494277,-1.17313870691902},{-1.08079689039279,0.189704178324845,-1.29632412372177,-1.4397181713443},{0.956193740128579,-0.0626381721036282,0.897293441455367,1.09278674069589},{0.956193740128579,-0.0626381721036282,0.897293441455367,1.09278674069589},{1
 .46544139775892,0.189704178324845,0.719432557792356,0.42633807963268},{0.0650103392754793,-1.07200757381752,0.185849906803323,0.0264688829947554},{1.08350565453616,-0.0626381721036282,0.422997751687338,0.293048347420038},{0.319634168090651,-0.314980522532101,0.482284712908341,0.42633807963268},{-0.82617306157762,1.95610063132415,-1.23703716250076,-1.30642843913166},{0.956193740128579,-0.0626381721036282,1.25301520878139,1.35936620512117},{-0.0623015751321059,-1.07200757381752,-0.110584899301695,-0.240110581430527},{-0.571549232762449,1.70375828089568,-1.29632412372177,-1.30642843913166},{-0.571549232762449,1.70375828089568,-1.29632412372177,-1.30642843913166},{2.35662479861202,-0.0626381721036282,1.72731089854942,1.22607647290853},{-1.71735646243072,0.442046528753317,-1.41489804616377,-1.30642843913166},{1.72006522657409,-0.0626381721036282,1.31230217000239,1.22607647290853},{-0.953484975985206,0.946731229610261,-1.29632412372177,-1.30642843913166},{-1.46273263361555,0.9467312296102
 61,-1.35561108494277,-1.17313870691902},{-1.08079689039279,-0.0626381721036282,-1.35561108494277,-1.30642843913166},{-0.953484975985206,1.45141593046721,-1.35561108494277,-1.30642843913166},{0.701569911313408,-1.82903462510294,0.422997751687338,0.159758615207397},{-0.444237318354863,2.20844298175262,-1.17775020127976,-1.03984897470638},{-0.0623015751321059,-0.314980522532101,0.304423829245331,0.159758615207397},{1.33812948335134,-0.0626381721036282,1.07515432511838,1.22607647290853}}
+3 | {{0,1,0},{0,1,0},{0,1,0},{0,1,0},{1,0,0},{1,0,0},{0,0,1},{0,1,0},{1,0,0},{0,1,0},{1,0,0},{0,1,0},{0,1,0},{0,0,1},{1,0,0},{0,1,0},{0,1,0},{0,0,1},{1,0,0},{1,0,0},{0,1,0},{0,0,1},{1,0,0},{0,1,0},{0,0,1},{0,1,0},{0,0,1},{0,1,0},{0,1,0},{0,1,0}} | {{-0.953484975985206,-1.82903462510294,-0.229158821743702,-0.240110581430527},{0.319634168090651,-2.08137697553141,0.185849906803323,-0.240110581430527},{-0.189613489539692,-0.0626381721036282,0.482284712908341,0.42633807963268},{-0.316925403947277,-1.07200757381752,0.422997751687338,0.0264688829947554},{-0.953484975985206,1.19907358003873,-1.23703716250076,-0.773269510281093},{-0.316925403947277,1.19907358003873,-1.41489804616377,-1.30642843913166},{0.0650103392754793,-0.819665223389045,0.838006480234363,0.959497008483245},{0.446946082498236,-0.0626381721036282,0.541571674129345,0.293048347420038},{-0.444237318354863,0.946731229610261,-1.29632412372177,-1.03984897470638},{1.21081756894375,0.189704178324845,0.600858635350349,0.426338079632
 68},{-0.82617306157762,1.95610063132415,-1.23703716250076,-1.30642843913166},{-0.0623015751321059,-0.567322872960574,0.245136868024327,0.159758615207397},{-0.316925403947277,-1.82903462510294,0.185849906803323,0.159758615207397},{1.21081756894375,-0.0626381721036282,0.897293441455367,1.49265593733381},{-1.59004454802313,-1.82903462510294,-1.41489804616377,-1.17313870691902},{0.701569911313408,0.694388879181789,0.600858635350349,0.559627811845321},{-0.316925403947277,-1.57669227467446,0.00798902314031256,-0.240110581430527},{1.46544139775892,0.189704178324845,1.01586736389737,1.22607647290853},{-1.08079689039279,0.189704178324845,-1.29632412372177,-1.4397181713443},{-1.71735646243072,-0.314980522532101,-1.35561108494277,-1.30642843913166},{-0.444237318354863,-0.0626381721036282,0.482284712908341,0.42633807963268},{1.72006522657409,-0.0626381721036282,1.31230217000239,1.22607647290853},{-0.82617306157762,1.95610063132415,-1.05917627883775,-1.03984897470638},{1.21081756894375,-0.062638
 1721036282,0.778719519013359,0.692917544057962},{2.35662479861202,-0.0626381721036282,1.72731089854942,1.22607647290853},{-0.953484975985206,-1.82903462510294,-0.229158821743702,-0.240110581430527},{0.701569911313408,-0.314980522532101,1.13444128633938,0.826207276270604},{-0.698861147170034,-0.819665223389045,0.12656294558232,0.293048347420038},{-0.0623015751321059,-0.314980522532101,0.304423829245331,0.159758615207397},{0.574257996905822,-0.314980522532101,0.363710790466334,0.159758615207397}}
+4 | {{0,0,1},{0,1,0},{0,0,1},{0,1,0},{1,0,0},{0,1,0},{0,1,0},{0,0,1},{0,0,1},{0,1,0},{0,0,1},{0,0,1},{1,0,0},{0,1,0},{0,1,0},{0,1,0},{0,1,0},{0,1,0},{0,0,1},{1,0,0},{0,1,0}} | {{1.21081756894375,0.694388879181789,1.19372824756038,1.75923540175909},{-0.82617306157762,-1.32434992424599,-0.407019705406713,-0.106820849217886},{0.701569911313408,0.694388879181789,1.3715891312234,1.75923540175909},{0.0650103392754793,-0.819665223389045,0.245136868024327,-0.240110581430527},{-1.20810880480038,0.189704178324845,-1.23703716250076,-1.30642843913166},{0.574257996905822,-0.314980522532101,0.363710790466334,0.159758615207397},{1.21081756894375,0.189704178324845,0.422997751687338,0.293048347420038},{1.97468905538926,-0.314980522532101,1.54945001488641,0.826207276270604},{-1.08079689039279,-1.32434992424599,0.482284712908341,0.692917544057962},{0.0650103392754793,-0.819665223389045,0.12656294558232,0.0264688829947554},{0.574257996905822,0.946731229610261,1.01586736389737,1.49265593733381},{0.95619
 3740128579,0.442046528753317,0.838006480234363,1.09278674069589},{-1.20810880480038,-0.0626381721036282,-1.35561108494277,-1.17313870691902},{0.828881825720994,0.442046528753317,0.482284712908341,0.42633807963268},{-0.0623015751321059,-0.0626381721036282,0.304423829245331,0.0264688829947554},{-0.316925403947277,-1.57669227467446,0.0672759843613159,-0.106820849217886},{-0.189613489539692,-0.0626381721036282,0.245136868024327,0.159758615207397},{1.59275331216651,0.442046528753317,0.600858635350349,0.293048347420038},{0.956193740128579,-0.0626381721036282,1.25301520878139,1.35936620512117},{-1.33542071920796,0.442046528753317,-1.23703716250076,-1.30642843913166},{-0.316925403947277,-1.32434992424599,0.185849906803323,0.159758615207397}}
+\.
+
+-- Create the corresponding summary table for preprocessed data
+CREATE TABLE iris_data_batch_summary(
+    source_table text,
+    output_table text,
+    dependent_varname text,
+    independent_varname text,
+    dependent_vartype text,
+    buffer_size integer,
+    class_values text[],
+    num_rows_processed integer,
+    num_rows_skipped integer,
+    grouping_cols text
+);
+-- The availability of the original source table should not be a condition for
+-- MLP to work correctly. It should work fine even the original source table is
+-- deleted (this basically ensures that all the necessary info is captured in
+-- the summary table). So name the original source table as
+-- 'iris_data_does_not_exist' instead of the original 'iris_data', to mimic the
+-- scenario where the original source table is deleted and MLP is trained with
+-- the preprocessed table.
+INSERT INTO iris_data_batch_summary VALUES
+('iris_data_does_not_exist', 'iris_data_batch', 'class::TEXT', 'attributes',
+    'text', 30, ARRAY[1,2,3], 141, 0, '');
+-- Create the corresponding standardization table for preprocessed data
+CREATE TABLE iris_data_batch_standardization(
+    mean double precision[],
+    std double precision[]
+);
+INSERT INTO iris_data_batch_standardization VALUES
+-- -- TODO get real numbers by running preprocessor
+(ARRAY[5.74893617021,3.02482269504,3.6865248227,1.18014184397],
+    ARRAY[0.785472439601,0.396287027644,1.68671151195,0.750245336531]);
+
+-- -- minibatch without grouping and without warm_start
+DROP TABLE IF EXISTS mlp_class_batch, mlp_class_batch_summary, mlp_class_batch_standardization;
+SELECT mlp_classification(
+    'iris_data_batch',    -- Source table
+    'mlp_class_batch',    -- Desination table
+    'independent_varname',   -- Input features
+    'dependent_varname',        -- Label
+    ARRAY[5],   -- Number of units per layer
+    'learning_rate_init=0.1,
+    learning_rate_policy=constant,
+    n_iterations=5,
+    n_tries=3,
+    tolerance=0,
+    n_epochs=20',
+    'sigmoid',
+    '',
+    False,
+    False
+);

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/crf/test/crf_test_small.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/crf/test/crf_test_small.ic.sql_in b/src/ports/postgres/modules/crf/test/crf_test_small.ic.sql_in
new file mode 100644
index 0000000..d258bb1
--- /dev/null
+++ b/src/ports/postgres/modules/crf/test/crf_test_small.ic.sql_in
@@ -0,0 +1,130 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+---------------------------------------------------------------------------
+-- Rules:
+-- ------
+-- 1) Any DB objects should be created w/o schema prefix,
+--    since this file is executed in a separate schema context.
+-- 2) There should be no DROP statements in this script, since
+--    all objects created in the default schema will be cleaned-up outside.
+---------------------------------------------------------------------------
+
+	-- Documents table
+	-- CREATE TABLE crf_document (id integer,text text);
+ --        INSERT INTO  crf_document VALUES
+ --        (1,E'Chancellor  of  the  Exchequer  Nigel  Lawson  ''s  restated  commitment  to  a  firm monetary  policy  has  helped  to  prevent  a  freefall  in  sterling  over  the  past  week  .'),
+ --        (2,E'But  analysts  reckon  underlying  support  for  sterling  has  been  eroded  by  the  chancellor ''s  failure  to  announce  any  new  policy  measures  in  his  Mansion  House  speech  last  Thursday  .'),
+ --        (3,E'His actions prevent disaster.');
+	-- analyze crf_document;
+
+	-- Features table
+	CREATE TABLE crf_feature_test (id integer,name text,prev_label_id integer,label_id integer,weight float);
+        INSERT INTO crf_feature_test VALUES
+	(7,'E.2',2,13,0.8957754882780667),           (79,'W_by',-1,5,2.4007337770109434),         (41,'U',-1,26,1.1971775735896324),
+	(81,'E.11',11,16,2.5835310903807915),        (55,'E.11',11,43,1.7591747767619539),        (39,'E.29',29,24,0.6423980041639374),
+	(27,'E.2',2,11,4.021547537882094),           (46,'W_in',-1,5,4.561697530405777),          (53,'W_past',-1,6,2.425102532944761),
+	(25,'E.24',24,2,2.6245019400744196),         (47,'E.5',5,11,2.475011699159048),           (33,'W_policy',-1,11,3.279737748615338),
+	(4,'W_of',-1,5,2.874451743664169),           (83,'W_failure',-1,11,1.6214155026731378),   (71,'R_endsWithIng',-1,28,1.944154984738804),
+	(2,'E.13',13,5,2.3995379106666896),          (94,'R_endsWithS',-1,18,2.1572134278343764), (38,'W_helped',-1,29,0.9484097417725005),
+	(96,'W_mansion',-1,13,2.3149078814680406),   (86,'W_any',-1,2,2.7954051826004025),        (88,'E.11',11,12,2.197492184359893),
+	(72,'E.28',28,11,2.692901638424271),         (48,'W_sterling',-1,11,2.3077819829037525),  (40,'E.24',24,26,3.7011711026137646),
+	(13,'W_lawson',-1,13,3.297240879683435),     (24,'W_to',-1,24,4.53050982922731),          (52,'E.2',2,6,3.1609626598041642),
+	(68,'E.30',30,28,2.900795206516394),         (54,'W_week',-1,11,3.282148235551298),       (10,'R_endsWithER',-1,13,2.449609048325598),
+	(63,'W_analysts',-1,12,1.0628309233894724),  (92,'U',-1,18,1.025730795623997),            (16,'E.16',16,29,1.9204482801150826),
+	(61,'E.0',0,12,2.6373656761539523),          (18,'W_restated',-1,29,1.3818282059971994),  (22,'W_commitment',-1,11,2.3459023587828263),
+	(87,'W_new',-1,6,2.6360680819475757),        (64,'R_endsWithS',-1,12,2.442307827871107),  (73,'W_support',-1,11,2.2821572827946244),
+	(60,'W_but',-1,0,2.728742100277871),         (101,'E.6',6,13,1.8014203700324123),         (56,'End.',-1,43,3.4595408822624947),
+	(26,'W_a',-1,2,2.677789823998926),           (19,'R_endsWithED',-1,29,3.8020681451775755),(29,'E.11',11,6,2.492292680092348),
+	(70,'W_underlying',-1,28,2.09432344174987),  (28,'W_firm',-1,11,1.9657228422125872),      (75,'W_been',-1,29,2.129129599248343),
+	(45,'E.11',11,5,2.831083871985474),          (5,'E.5',5,2,3.771637726308954),             (57,'W_.',-1,43,3.4595408822624947),
+	(32,'E.6',6,11,2.938177772428602),           (100,'W_last',-1,6,3.6718959040221013),      (15,'W_''s',-1,16,5.074336301920056),
+	(1,'W_chancellor',-1,13,2.232243177253394),  (34,'E.11',11,31,2.703318944384476),         (8,'U',-1,13,1.7587494934234644),
+	(89,'W_measures',-1,12,2.2889484722940523),  (0,'S.',-1,13,3.3985336034127775),           (97,'W_house',-1,13,3.6015166265995555),
+	(44,'W_freefall',-1,11,1.8006899570542791),  (62,'U',-1,12,1.3209737215186312),           (20,'E.29',29,11,1.5449358644830369),
+	(9,'W_exchequer',-1,13,2.721269156136535),   (80,'W_chancellor',-1,11,1.796888201507293), (21,'U',-1,11,1.4739961541941164),
+	(102,'W_thursday',-1,13,3.858752037897991),  (37,'E.31',31,29,3.3704387252974217),        (51,'R_endsWithER',-1,5,1.523379944589324),
+	(6,'W_the',-1,2,4.179075274351749),          (95,'E.18',18,13,2.0919068469315785),        (42,'W_prevent',-1,26,1.9130956387223363),
+	(93,'W_his',-1,18,2.440330155099354),        (36,'R_endsWithS',-1,31,2.092642289935937),  (35,'W_has',-1,31,2.452210128238285),
+	(14,'E.13',13,16,1.8094401262382602),        (23,'E.11',11,24,3.4046169042228858),        (30,'U',-1,6,1.7397221015334599),
+	(103,'E.13',13,43,2.1545378214335686),       (78,'E.29',29,5,1.8987300180101108),         (49,'R_endsWithIng',-1,11,1.8058171678503487),
+	(77,'W_eroded',-1,29,1.4718301974078694),    (3,'U',-1,5,1.216476575073629),              (90,'E.12',12,5,1.9609403598006498),
+	(50,'W_over',-1,5,1.5851324863666807),       (43,'E.26',26,2,3.399063749955467),          (11,'E.13',13,13,2.9624483035010245),
+	(91,'E.5',5,18,2.1990281868655663),          (66,'U',-1,30,1.4276079759935312),           (76,'E.29',29,29,1.6793149556330953),
+	(65,'E.12',12,30,2.4029290723287544),        (12,'W_nigel',-1,13,2.0372945323878744),     (85,'U',-1,2,-0.4472670967738198),
+	(17,'U',-1,29,1.6546332503126648),           (98,'E.13',13,11,1.9289929156050765),        (84,'W_announce',-1,26,1.8999638426719463),
+	(99,'W_speech',-1,11,3.570619697477909),     (69,'U',-1,28,0.8360198402652405),           (74,'W_for',-1,5,4.0872624914833775),
+	(31,'W_monetary',-1,6,3.3195839909271014),   (59,'U',-1,0,1.6822590692281079),            (82,'E.16',16,11,2.3919190723943817),
+	(58,'S.',-1,0,2.3563399364223314),           (67,'W_reckon',-1,30,2.397247084073005);
+
+	-- Dictionary table
+	CREATE TABLE crf_dictionary (token text,total integer);
+        INSERT INTO crf_dictionary VALUES
+	('freefall',1),  ('policy',2),  ('measures',1), ('commitment',1),
+	('new',1),       ('speech',1),  ('''s',2),      ('reckon',1),
+	('underlying',1),('week',1),    ('prevent',1),  ('has',2),
+	('failure',1),   ('restated',1),('announce',1), ('thursday',1),
+	('but',1),       ('lawson',1),  ('last',1),     ('firm',1),
+	('exchequer',1), ('helped',1),  ('sterling',2), ('been',1),
+	('his',1),       ('.',2),       ('the',3),      ('chancellor',2),
+	('chancellor',2),('in',2),      ('any',1),      ('analysts',1),
+	('of',1),        ('support',1), ('by',1),       ('over',1),
+	('for',1),       ('monetary',1),('mansion',1),  ('eroded',1),
+	('house',1),     ('a',2),       ('nigel',1),    ('to',3),
+	('past',1);
+
+	-- Regex table
+	CREATE TABLE crf_regex (pattern text,name text);
+        INSERT INTO crf_regex VALUES
+        ('^[A-Z][a-z]+$','InitCapital'), ('^[A-Z]+$','isAllCapital'), ('^.*[0-9]+.*$','containsDigit'),
+        ('^.+[.]$','endsWithDot'),       ('^.+[,]$','endsWithComma'), ('^.+er$','endsWithER'),
+        ('^.+est$','endsWithEst'),       ('^.+ed$','endsWithED'),     ('^.+s$','endsWithS'),
+        ('^.+ing$','endsWithIng'),       ('^.+ly$','endsWithly'),     ('^.+-.+$','isDashSeparatedWords'),
+        ('^.*@.*$','isEmailId');
+
+	-- Labels table
+	CREATE TABLE test_crf_label (id integer,label character varying);
+        INSERT INTO test_crf_label VALUES
+        (0,'CC'),   (1,'CD'),  (2,'DT'),    (3,'EX'),   (4,'FW'),  (5,'IN'),   (6,'JJ'),  (7,'JJR'), (8,'JJS'),
+        (9,'LS'),   (10,'MD'), (11,'NN'),   (12,'NNS'), (13,'NNP'),(14,'NNPS'),(15,'PDT'),(16,'POS'),(17,'PRP'),
+        (18,'PRP$'),(19,'RB'), (20,'RBR'),  (21,'RBS'), (22,'RP'), (23,'SYM'), (24,'TO'), (25,'UH'), (26,'VB'),
+        (27,'VBD'), (28,'VBG'),(29,'VBN'),  (30,'VBP'), (31,'VBZ'),(32,'WDT'), (33,'WP'), (34,'WP$'),(35,'WRB'),
+        (36,'$'),   (37,'#'),  (38,''''''), (39,'``'),  (40,'('),  (41,')'),   (42,','),  (43,'.'),  (44,':');
+
+	-- Segment table
+	CREATE TABLE test_segmenttbl (start_pos integer,doc_id integer,seg_text text,max_pos integer);
+        INSERT INTO test_segmenttbl VALUES
+        (0,1,'chancellor',26),(1,1,'of',26),       (2,1,'the',26),      (3,1,'exchequer',26), (4,1,'nigel',26),
+	(5,1,'lawson',26),    (6,1,'''s',26),      (7,1,'restated',26), (8,1,'commitment',26),(9,1,'to',26),
+	(10,1,'a',26),        (11,1,'firm',26),    (12,1,'monetary',26),(13,1,'policy',26),   (14,1,'has',26),
+	(15,1,'helped',26),   (16,1,'to',26),      (17,1,'prevent',26), (18,1,'a',26),        (19,1,'freefall',26),
+	(20,1,'in',26),       (21,1,'sterling',26),(22,1,'over',26),    (23,1,'the',26),      (24,1,'past',26),
+	(25,1,'week',26),     (26,1,'.',26),       (0,2,'but',28),      (1,2,'analysts',28),  (2,2,'reckon',28),
+	(3,2,'underlying',28),(4,2,'support',28),  (5,2,'for',28),      (6,2,'sterling',28),  (7,2,'has',28),
+	(8,2,'been',28),      (9,2,'eroded',28),   (10,2,'by',28),      (11,2,'the',28),      (12,2,'chancellor',28),
+	(13,2,'''s',28),      (14,2,'failure',28), (15,2,'to',28),      (16,2,'announce',28), (17,2,'any',28),
+	(18,2,'new',28),      (19,2,'policy',28),  (20,2,'measures',28),(21,2,'in',28),       (22,2,'his',28),
+	(23,2,'mansion',28),  (24,2,'house',28),   (25,2,'speech',28),  (26,2,'last',28),     (27,2,'thursday',28),
+	(28,2,'.',28),        (0,3,'his',4),       (1,3,'actions',4),   (2,3,'prevent',4),    (3,3,'disaster',4),
+        (4,3,'.',4);
+
+	-- extract features for tokens stored in segmenttbl
+	SELECT crf_test_fgen('test_segmenttbl','crf_dictionary','test_crf_label','crf_regex','crf_feature_test','viterbi_mtbl','viterbi_rtbl');

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/crf/test/crf_train_small.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/crf/test/crf_train_small.ic.sql_in b/src/ports/postgres/modules/crf/test/crf_train_small.ic.sql_in
new file mode 100644
index 0000000..6f89edb
--- /dev/null
+++ b/src/ports/postgres/modules/crf/test/crf_train_small.ic.sql_in
@@ -0,0 +1,83 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+---------------------------------------------------------------------------
+-- Rules:
+-- ------
+-- 1) Any DB objects should be created w/o schema prefix,
+--    since this file is executed in a separate schema context.
+-- 2) There should be no DROP statements in this script, since
+--    all objects created in the default schema will be cleaned-up outside.
+--
+-- This test is not performed in those platforms which don't support
+-- ORDERED AGGREGATES.
+---------------------------------------------------------------------------
+
+m4_include(`SQLCommon.m4')
+m4_changequote(<!,!>)
+
+m4_ifdef(<!__HAS_ORDERED_AGGREGATES__!>,<!
+
+	-- Regex table
+        CREATE TABLE train_regex(pattern text,name text);
+        INSERT INTO train_regex VALUES
+        ('^[A-Z][a-z]+$','InitCapital'), ('^[A-Z]+$','isAllCapital'),
+        ('^.*[0-9]+.*$','containsDigit'),('^.+[.]$','endsWithDot'),
+        ('^.+[,]$','endsWithComma'),     ('^.+er$','endsWithER'),
+        ('^.+est$','endsWithEst'),       ('^.+ed$','endsWithED'),
+        ('^.+s$','endsWithS'),           ('^.+ing$','endsWithIng'),
+        ('^.+ly$','endsWithly'),         ('^.+-.+$','isDashSeparatedWords'),
+        ('^.*@.*$','isEmailId');
+
+	    -- Label table
+        CREATE TABLE crf_label (id integer,label character varying);
+        INSERT INTO crf_label VALUES
+        (0,'CC'),   (1,'CD'),  (2,'DT'),    (3,'EX'),   (4,'FW'),  (5,'IN'),   (6,'JJ'),  (7,'JJR'), (8,'JJS'),
+        (9,'LS'),   (10,'MD'), (11,'NN'),   (12,'NNS'), (13,'NNP'),(14,'NNPS'),(15,'PDT'),(16,'POS'),(17,'PRP'),
+        (18,'PRP$'),(19,'RB'), (20,'RBR'),  (21,'RBS'), (22,'RP'), (23,'SYM'), (24,'TO'), (25,'UH'), (26,'VB'),
+        (27,'VBD'), (28,'VBG'),(29,'VBN'),  (30,'VBP'), (31,'VBZ'),(32,'WDT'), (33,'WP'), (34,'WP$'),(35,'WRB'),
+        (36,'$'),   (37,'#'),  (38,''''''), (39,'``'),  (40,'('),  (41,')'),   (42,','),  (43,'.'),  (44,':');
+
+        CREATE TABLE train_segmenttbl(start_pos integer,doc_id integer,seg_text text,label integer,max_pos integer);
+        INSERT INTO train_segmenttbl VALUES
+        (0,1,'confidence',11,36),  (1,1,'in',5,36),         (2,1,'the',2,36),         (3,1,'pound',11,36),
+        (4,1,'is',31,36),          (5,1,'widely',19,36),    (6,1,'expected',29,36),   (7,1,'to',24,36),
+        (8,1,'take',26,36),        (9,1,'another',2,36),    (10,1,'sharp',6,36),      (11,1,'dive',11,36),
+        (12,1,'if',5,36),          (13,1,'trade',11,36),    (14,1,'figures',12,36),   (15,1,'for',5,36),
+        (16,1,'september',13,36),  (17,1,',',42,36),        (18,1,'due',6,36),        (19,1,'for',5,36),
+        (20,1,'release',11,36),    (21,1,'tomorrow',11,36), (22,1,',',42,36),         (23,1,'fail',26,36),
+        (24,1,'to',24,36),         (25,1,'show',26,36),     (26,1,'a',2,36),          (27,1,'substantial',6,36),
+        (28,1,'improvement',11,36),(29,1,'from',5,36),      (30,1,'july',13,36),      (31,1,'and',0,36),
+        (32,1,'august',13,36),     (33,1,'''s',16,36),      (34,1,'near-record',6,36),(35,1,'deficits',12,36),
+        (36,1,'.',43,36),          (0,2,'chancellor',13,26),(1,2,'of',5,26),          (2,2,'the',2,26),
+        (3,2,'exchequer',13,26),   (4,2,'nigel',13,26),     (5,2,'lawson',13,26),     (6,2,'''s',16,26),
+        (7,2,'restated',29,26),    (8,2,'commitment',11,26),(9,2,'to',24,26),         (10,2,'a',2,26),
+        (11,2,'firm',11,26),       (12,2,'monetary',6,26),  (13,2,'policy',11,26),    (14,2,'has',31,26),
+        (15,2,'helped',29,26),     (16,2,'to',24,26),       (17,2,'prevent',26,26),   (18,2,'a',2,26),
+        (19,2,'freefall',11,26),   (20,2,'in',5,26),        (21,2,'sterling',11,26),  (22,2,'over',5,26),
+        (23,2,'the',2,26),         (24,2,'past',6,26),      (25,2,'week',11,26),      (26,2,'.',43,26);
+
+
+        SELECT crf_train_fgen('train_segmenttbl', 'train_regex', 'crf_label', 'train_dictionary', 'train_featuretbl','train_featureset');
+
+
+!>)
+m4_changequote(<!`!>,<!'!>)

http://git-wip-us.apache.org/repos/asf/madlib/blob/4ed8b35e/src/ports/postgres/modules/elastic_net/test/elastic_net.ic.sql_in
----------------------------------------------------------------------
diff --git a/src/ports/postgres/modules/elastic_net/test/elastic_net.ic.sql_in b/src/ports/postgres/modules/elastic_net/test/elastic_net.ic.sql_in
new file mode 100644
index 0000000..037a6b1
--- /dev/null
+++ b/src/ports/postgres/modules/elastic_net/test/elastic_net.ic.sql_in
@@ -0,0 +1,194 @@
+/* ----------------------------------------------------------------------- *//**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *//* ----------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------------------
+ * Install check for Elastic Net
+ * ------------------------------------------------------------------------ */
+
+DROP TABLE IF EXISTS lin_housing_wi;
+CREATE TABLE lin_housing_wi (id serial, x float8[], grp_by_col int, y float8);
+COPY lin_housing_wi (x, grp_by_col, y) FROM STDIN NULL '?' DELIMITER '|';
+{1,0.00632,18.00,2.310,NULL,0.5380,6.5750,NULL,4.0900,1,296.0,15.30,396.90,4.98} | 1 | 24.00
+{1,0.00632,18.00,2.310,0,0.5380,6.5750,65.20,4.0900,1,296.0,15.30,396.90,4.98} | 1 | 24.00
+{1,0.02731,0.00,7.070,0,0.4690,6.4210,78.90,4.9671,2,242.0,17.80,396.90,9.14} | 1 | 21.60
+{1,0.02729,0.00,7.070,0,0.4690,7.1850,61.10,4.9671,2,242.0,17.80,392.83,4.03} | 1 | 34.70
+{1,0.03237,0.00,2.180,0,0.4580,6.9980,45.80,6.0622,3,222.0,18.70,394.63,2.94} | 1 | 33.40
+{1,0.06905,0.00,2.180,0,0.4580,7.1470,54.20,6.0622,3,222.0,18.70,396.90,5.33} | 1 | 36.20
+{1,0.02985,0.00,2.180,0,0.4580,6.4300,58.70,6.0622,3,222.0,18.70,394.12,5.21} | 1 | 28.70
+{1,0.08829,12.50,7.870,0,0.5240,6.0120,66.60,5.5605,5,311.0,15.20,395.60,12.43} | 1 | 22.90
+{1,0.14455,12.50,7.870,0,0.5240,6.1720,96.10,5.9505,5,311.0,15.20,396.90,19.15} | 1 | 27.10
+{1,0.21124,12.50,7.870,0,0.5240,5.6310,100.00,6.0821,5,311.0,15.20,386.63,29.93} | 1 | 16.50
+{1,0.17004,12.50,7.870,0,0.5240,6.0040,85.90,6.5921,5,311.0,15.20,386.71,17.10} | 1 | 18.90
+{1,0.22489,12.50,7.870,0,0.5240,6.3770,94.30,6.3467,5,311.0,15.20,392.52,20.45} | 1 | 15.00
+{1,0.11747,12.50,7.870,0,0.5240,6.0090,82.90,6.2267,5,311.0,15.20,396.90,13.27} | 1 | 18.90
+{1,0.09378,12.50,7.870,0,0.5240,5.8890,39.00,5.4509,5,311.0,15.20,390.50,15.71} | 1 | 21.70
+{1,0.62976,0.00,8.140,0,0.5380,5.9490,61.80,4.7075,4,307.0,21.00,396.90,8.26} | 1 | 20.40
+{1,0.63796,0.00,8.140,0,0.5380,6.0960,84.50,4.4619,4,307.0,21.00,380.02,10.26} | 1 | 18.20
+{1,0.62739,0.00,8.140,0,0.5380,5.8340,56.50,4.4986,4,307.0,21.00,395.62,8.47} | 1 | 19.90
+{1,1.05393,0.00,8.140,0,0.5380,5.9350,29.30,4.4986,4,307.0,21.00,386.85,6.58} | 1 | 23.10
+{1,0.78420,0.00,8.140,0,0.5380,5.9900,81.70,4.2579,4,307.0,21.00,386.75,14.67} | 1 | 17.50
+{1,0.80271,0.00,8.140,0,0.5380,5.4560,36.60,3.7965,4,307.0,21.00,288.99,11.69} | 1 | 20.20
+{1,0.72580,0.00,8.140,0,0.5380,5.7270,69.50,3.7965,4,307.0,21.00,390.95,11.28} | 1 | 18.20
+{1,1.25179,0.00,8.140,0,0.5380,5.5700,98.10,3.7979,4,307.0,21.00,376.57,21.02} | 1 | 13.60
+{1,0.85204,0.00,8.140,0,0.5380,5.9650,89.20,4.0123,4,307.0,21.00,392.53,13.83} | 1 | 19.60
+{1,1.23247,0.00,8.140,0,0.5380,6.1420,91.70,3.9769,4,307.0,21.00,396.90,18.72} | 1 | 15.20
+{1,0.98843,0.00,8.140,0,0.5380,5.8130,100.00,4.0952,4,307.0,21.00,394.54,19.88} | 1 | 14.50
+{1,0.75026,0.00,8.140,0,0.5380,5.9240,94.10,4.3996,4,307.0,21.00,394.33,16.30} | 1 | 15.60
+{1,0.84054,0.00,8.140,0,0.5380,5.5990,85.70,4.4546,4,307.0,21.00,303.42,16.51} | 1 | 13.90
+{1,0.67191,0.00,8.140,0,0.5380,5.8130,90.30,4.6820,4,307.0,21.00,376.88,14.81} | 1 | 16.60
+{1,0.95577,0.00,8.140,0,0.5380,6.0470,88.80,4.4534,4,307.0,21.00,306.38,17.28} | 1 | 14.80
+{1,0.77299,0.00,8.140,0,0.5380,6.4950,94.40,4.4547,4,307.0,21.00,387.94,12.80} | 1 | 18.40
+{1,1.00245,0.00,8.140,0,0.5380,6.6740,87.30,4.2390,4,307.0,21.00,380.23,11.98} | 1 | 21.00
+{1,1.13081,0.00,8.140,0,0.5380,5.7130,94.10,4.2330,4,307.0,21.00,360.17,22.60} | 1 | 12.70
+{1,1.35472,0.00,8.140,0,0.5380,6.0720,100.00,4.1750,4,307.0,21.00,376.73,13.04} | 1 | 14.50
+{1,1.38799,0.00,8.140,0,0.5380,5.9500,82.00,3.9900,4,307.0,21.00,232.60,27.71} | 1 | 13.20
+{1,1.15172,0.00,8.140,0,0.5380,5.7010,95.00,3.7872,4,307.0,21.00,358.77,18.35} | 1 | 13.10
+{1,1.61282,0.00,8.140,0,0.5380,6.0960,96.90,3.7598,4,307.0,21.00,248.31,20.34} | 1 | 13.50
+{1,0.06417,0.00,5.960,0,0.4990,5.9330,68.20,3.3603,5,279.0,19.20,396.90,9.68} | 1 | 18.90
+{1,0.09744,0.00,5.960,0,0.4990,5.8410,61.40,3.3779,5,279.0,19.20,377.56,11.41} | 1 | 20.00
+{1,0.08014,0.00,5.960,0,0.4990,5.8500,41.50,3.9342,5,279.0,19.20,396.90,8.77} | 1 | 21.00
+{1,0.17505,0.00,5.960,0,0.4990,5.9660,30.20,3.8473,5,279.0,19.20,393.43,10.13} | 1 | 24.70
+{1,0.02763,75.00,2.950,0,0.4280,6.5950,21.80,5.4011,3,252.0,18.30,395.63,4.32} | 1 | 30.80
+{1,0.03359,75.00,2.950,0,0.4280,7.0240,15.80,5.4011,3,252.0,18.30,395.62,1.98} | 1 | 34.90
+{1,0.12744,0.00,6.910,0,0.4480,6.7700,2.90,5.7209,3,233.0,17.90,385.41,4.84} | 1 | 26.60
+{1,0.14150,0.00,6.910,0,0.4480,6.1690,6.60,5.7209,3,233.0,17.90,383.37,5.81} | 1 | 25.30
+{1,0.15936,0.00,6.910,0,0.4480,6.2110,6.50,5.7209,3,233.0,17.90,394.46,7.44} | 1 | 24.70
+{1,0.12269,0.00,6.910,0,0.4480,6.0690,40.00,5.7209,3,233.0,17.90,389.39,9.55} | 1 | 21.20
+{1,0.17142,0.00,6.910,0,0.4480,5.6820,33.80,5.1004,3,233.0,17.90,396.90,10.21} | 1 | 19.30
+{1,0.18836,0.00,6.910,0,0.4480,5.7860,33.30,5.1004,3,233.0,17.90,396.90,14.15} | 1 | 20.00
+{1,0.22927,0.00,6.910,0,0.4480,6.0300,85.50,5.6894,3,233.0,17.90,392.74,18.80} | 1 | 16.60
+{1,0.25387,0.00,6.910,0,0.4480,5.3990,95.30,5.8700,3,233.0,17.90,396.90,30.81} | 1 | 14.40
+{1,0.21977,0.00,6.910,0,0.4480,5.6020,62.00,6.0877,3,233.0,17.90,396.90,16.20} | 1 | 19.40
+{1,0.08873,21.00,5.640,0,0.4390,5.9630,45.70,6.8147,4,243.0,16.80,395.56,13.45} | 1 | 19.70
+{1,0.04337,21.00,5.640,0,0.4390,6.1150,63.00,6.8147,4,243.0,16.80,393.97,9.43} | 1 | 20.50
+{1,0.05360,21.00,5.640,0,0.4390,6.5110,21.10,6.8147,4,243.0,16.80,396.90,5.28} | 1 | 25.00
+{1,0.04981,21.00,5.640,0,0.4390,5.9980,21.40,6.8147,4,243.0,16.80,396.90,8.43} | 1 | 23.40
+{1,0.01360,75.00,4.000,0,0.4100,5.8880,47.60,7.3197,3,469.0,21.10,396.90,14.80} | 1 | 18.90
+{1,0.01311,90.00,1.220,0,0.4030,7.2490,21.90,8.6966,5,226.0,17.90,395.93,4.81} | 1 | 35.40
+{1,0.02055,85.00,0.740,0,0.4100,6.3830,35.70,9.1876,2,313.0,17.30,396.90,5.77} | 1 | 24.70
+{1,0.01432,100.00,1.320,0,0.4110,6.8160,40.50,8.3248,5,256.0,15.10,392.90,3.95} | 1 | 31.60
+{1,0.15445,25.00,5.130,0,0.4530,6.1450,29.20,7.8148,8,284.0,19.70,390.68,6.86} | 1 | 23.30
+{1,0.10328,25.00,5.130,0,0.4530,5.9270,47.20,6.9320,8,284.0,19.70,396.90,9.22} | 1 | 19.60
+{1,0.14932,25.00,5.130,0,0.4530,5.7410,66.20,7.2254,8,284.0,19.70,395.11,13.15} | 1 | 18.70
+{1,0.17171,25.00,5.130,0,0.4530,5.9660,93.40,6.8185,8,284.0,19.70,378.08,14.44} | 1 | 16.00
+{1,0.11027,25.00,5.130,0,0.4530,6.4560,67.80,7.2255,8,284.0,19.70,396.90,6.73} | 1 | 22.20
+{1,0.12650,25.00,5.130,0,0.4530,6.7620,43.40,7.9809,8,284.0,19.70,395.58,9.50} | 1 | 25.00
+{1,0.01951,17.50,1.380,0,0.4161,7.1040,59.50,9.2229,3,216.0,18.60,393.24,8.05} | 1 | 33.00
+{1,0.03584,80.00,3.370,0,0.3980,6.2900,17.80,6.6115,4,337.0,16.10,396.90,4.67} | 1 | 23.50
+{1,0.04379,80.00,3.370,0,0.3980,5.7870,31.10,6.6115,4,337.0,16.10,396.90,10.24} | 1 | 19.40
+{1,0.05789,12.50,6.070,0,0.4090,5.8780,21.40,6.4980,4,345.0,18.90,396.21,8.10} | 1 | 22.00
+{1,0.13554,12.50,6.070,0,0.4090,5.5940,36.80,6.4980,4,345.0,18.90,396.90,13.09} | 1 | 17.40
+{1,0.12816,12.50,6.070,0,0.4090,5.8850,33.00,6.4980,4,345.0,18.90,396.90,8.79} | 1 | 20.90
+{1,0.08826,0.00,10.810,0,0.4130,6.4170,6.60,5.2873,4,305.0,19.20,383.73,6.72} | 1 | 24.20
+{1,0.15876,0.00,10.810,0,0.4130,5.9610,17.50,5.2873,4,305.0,19.20,376.94,9.88} | 1 | 21.70
+{1,0.09164,0.00,10.810,0,0.4130,6.0650,7.80,5.2873,4,305.0,19.20,390.91,5.52} | 1 | 22.80
+{1,0.19539,0.00,10.810,0,0.4130,6.2450,6.20,5.2873,4,305.0,19.20,377.17,7.54} | 1 | 23.40
+{1,0.07896,0.00,12.830,0,0.4370,6.2730,6.00,4.2515,5,398.0,18.70,394.92,6.78} | 1 | 24.10
+{1,0.09512,0.00,12.830,0,0.4370,6.2860,45.00,4.5026,5,398.0,18.70,383.23,8.94} | 1 | 21.40
+{1,0.10153,0.00,12.830,0,0.4370,6.2790,74.50,4.0522,5,398.0,18.70,373.66,11.97} | 1 | 20.00
+{1,0.08707,0.00,12.830,0,0.4370,6.1400,45.80,4.0905,5,398.0,18.70,386.96,10.27} | 1 | 20.80
+{1,0.05646,0.00,12.830,0,0.4370,6.2320,53.70,5.0141,5,398.0,18.70,386.40,12.34} | 1 | 21.20
+{1,0.08387,0.00,12.830,0,0.4370,5.8740,36.60,4.5026,5,398.0,18.70,396.06,9.10} | 1 | 20.30
+{1,0.04113,25.00,4.860,0,0.4260,6.7270,33.50,5.4007,4,281.0,19.00,396.90,5.29} | 1 | 28.00
+{1,0.04462,25.00,4.860,0,0.4260,6.6190,70.40,5.4007,4,281.0,19.00,395.63,7.22} | 1 | 23.90
+{1,0.03659,25.00,4.860,0,0.4260,6.3020,32.20,5.4007,4,281.0,19.00,396.90,6.72} | 1 | 24.80
+{1,0.03551,25.00,4.860,0,0.4260,6.1670,46.70,5.4007,4,281.0,19.00,390.64,7.51} | 1 | 22.90
+{1,0.05059,0.00,4.490,0,0.4490,6.3890,48.00,4.7794,3,247.0,18.50,396.90,9.62} | 1 | 23.90
+{1,0.05735,0.00,4.490,0,0.4490,6.6300,56.10,4.4377,3,247.0,18.50,392.30,6.53} | 1 | 26.60
+{1,0.05188,0.00,4.490,0,0.4490,6.0150,45.10,4.4272,3,247.0,18.50,395.99,12.86} | 1 | 22.50
+{1,0.07151,0.00,4.490,0,0.4490,6.1210,56.80,3.7476,3,247.0,18.50,395.15,8.44} | 1 | 22.20
+{1,0.05660,0.00,3.410,0,0.4890,7.0070,86.30,3.4217,2,270.0,17.80,396.90,5.50} | 1 | 23.60
+{1,0.05302,0.00,3.410,0,0.4890,7.0790,63.10,3.4145,2,270.0,17.80,396.06,5.70} | 1 | 28.70
+{1,0.04684,0.00,3.410,0,0.4890,6.4170,66.10,3.0923,2,270.0,17.80,392.18,8.81} | 1 | 22.60
+{1,0.03932,0.00,3.410,0,0.4890,6.4050,73.90,3.0921,2,270.0,17.80,393.55,8.20} | 1 | 22.00
+{1,0.04203,28.00,15.040,0,0.4640,6.4420,53.60,3.6659,4,270.0,18.20,395.01,8.16} | 1 | 22.90
+{1,0.02875,28.00,15.040,0,0.4640,6.2110,28.90,3.6659,4,270.0,18.20,396.33,6.21} | 1 | 25.00
+{1,0.04294,28.00,15.040,0,0.4640,6.2490,77.30,3.6150,4,270.0,18.20,396.90,10.59} | 1 | 20.60
+{1,0.12204,0.00,2.890,0,0.4450,6.6250,57.80,3.4952,2,276.0,18.00,357.98,6.65} | 1 | 28.40
+{1,0.11504,0.00,2.890,0,0.4450,6.1630,69.60,3.4952,2,276.0,18.00,391.83,11.34} | 1 | 21.40
+{1,0.12083,0.00,2.890,0,0.4450,8.0690,76.00,3.4952,2,276.0,18.00,396.90,4.21} | 1 | 38.70
+{1,0.08187,0.00,2.890,0,0.4450,7.8200,36.90,3.4952,2,276.0,18.00,393.53,3.57} | 1 | 43.80
+{1,0.06860,0.00,2.890,0,0.4450,7.4160,62.50,3.4952,2,276.0,18.00,396.90,6.19} | 1 | 33.20
+{1,0.14866,0.00,8.560,0,0.5200,6.7270,79.90,2.7778,5,384.0,20.90,394.76,9.42} | 1 | 27.50
+{1,0.11432,0.00,8.560,0,0.5200,6.7810,71.30,2.8561,5,384.0,20.90,395.58,7.67} | 1 | 26.50
+{1,0.22876,0.00,8.560,0,0.5200,6.4050,85.40,2.7147,5,384.0,20.90,70.80,10.63} | 1 | 18.60
+{1,0.21161,0.00,8.560,0,0.5200,6.1370,87.40,2.7147,5,384.0,20.90,394.47,13.44} | 1 | 19.30
+{1,0.13960,0.00,8.560,0,0.5200,6.1670,90.00,2.4210,5,384.0,20.90,392.69,12.33} | 1 | 20.10
+{1,0.13262,0.00,8.560,0,0.5200,5.8510,96.70,2.1069,5,384.0,20.90,394.05,16.47} | 1 | 19.50
+{1,0.17120,0.00,8.560,0,0.5200,5.8360,91.90,2.2110,5,384.0,20.90,395.67,18.66} | 1 | 19.50
+{1,0.13117,0.00,8.560,0,0.5200,6.1270,85.20,2.1224,5,384.0,20.90,387.69,14.09} | 1 | 20.40
+{1,0.12802,0.00,8.560,0,0.5200,6.4740,97.10,2.4329,5,384.0,20.90,395.24,12.27} | 1 | 19.80
+{1,0.26363,0.00,8.560,0,0.5200,6.2290,91.20,2.5451,5,384.0,20.90,391.23,15.55} | 1 | 19.40
+{1,0.10793,0.00,8.560,0,0.5200,6.1950,54.40,2.7778,5,384.0,20.90,393.49,13.00} | 1 | 21.70
+{1,0.10084,0.00,10.010,0,0.5470,6.7150,81.60,2.6775,6,432.0,17.80,395.59,10.16} | 1 | 22.80
+{1,0.12329,0.00,10.010,0,0.5470,5.9130,92.90,2.3534,6,432.0,17.80,394.95,16.21} | 1 | 18.80
+{1,0.22212,0.00,10.010,0,0.5470,6.0920,95.40,2.5480,6,432.0,17.80,396.90,17.09} | 1 | 18.70
+{1,0.14231,0.00,10.010,0,0.5470,6.2540,84.20,2.2565,6,432.0,17.80,388.74,10.45} | 1 | 18.50
+{1,0.17134,0.00,10.010,0,0.5470,5.9280,88.20,2.4631,6,432.0,17.80,344.91,15.76} | 1 | 18.30
+{1,0.13158,0.00,10.010,0,0.5470,6.1760,72.50,2.7301,6,432.0,17.80,393.30,12.04} | 1 | 21.20
+{1,0.15098,0.00,10.010,0,0.5470,6.0210,82.60,2.7474,6,432.0,17.80,394.51,10.30} | 1 | 19.20
+{1,0.13058,0.00,10.010,0,0.5470,5.8720,73.10,2.4775,6,432.0,17.80,338.63,15.37} | 1 | 20.40
+{1,0.14476,0.00,10.010,0,0.5470,5.7310,65.20,2.7592,6,432.0,17.80,391.50,13.61} | 1 | 19.30
+{1,0.06899,0.00,25.650,0,0.5810,5.8700,69.70,2.2577,2,188.0,19.10,389.15,14.37} | 1 | 22.00
+{1,0.07165,0.00,25.650,0,0.5810,6.0040,84.10,2.1974,2,188.0,19.10,377.67,14.27} | 1 | 20.30
+{1,0.09299,0.00,25.650,0,0.5810,5.9610,92.90,2.0869,2,188.0,19.10,378.09,17.93} | 1 | 20.50
+{1,0.15038,0.00,25.650,0,0.5810,5.8560,97.00,1.9444,2,188.0,19.10,370.31,25.41} | 1 | 17.30
+{1,0.09849,0.00,25.650,0,0.5810,5.8790,95.80,2.0063,2,188.0,19.10,379.38,17.58} | 1 | 18.80
+{1,0.16902,0.00,25.650,0,0.5810,5.9860,88.40,1.9929,2,188.0,19.10,385.02,14.81} | 1 | 21.40
+{1,0.38735,0.00,25.650,0,0.5810,5.6130,95.60,1.7572,2,188.0,19.10,359.29,27.26} | 1 | 15.70
+{1,0.25915,0.00,21.890,0,0.6240,5.6930,96.00,1.7883,4,437.0,21.20,392.11,17.19} | 1 | 16.20
+{1,0.32543,0.00,21.890,0,0.6240,6.4310,98.80,1.8125,4,437.0,21.20,396.90,15.39} | 1 | 18.00
+{1,0.88125,0.00,21.890,0,0.6240,5.6370,94.70,1.9799,4,437.0,21.20,396.90,18.34} | 1 | 14.30
+{1,0.34006,0.00,21.890,0,0.6240,6.4580,98.90,2.1185,4,437.0,21.20,395.04,12.60} | 1 | 19.20
+{1,1.19294,0.00,21.890,0,0.6240,6.3260,97.70,2.2710,4,437.0,21.20,396.90,12.26} | 1 | 19.60
+{1,0.59005,0.00,21.890,0,0.6240,6.3720,97.90,2.3274,4,437.0,21.20,385.76,11.12} | 1 | 23.00
+{1,0.32982,0.00,21.890,0,0.6240,5.8220,95.40,2.4699,4,437.0,21.20,388.69,15.03} | 1 | 18.40
+{1,0.97617,0.00,21.890,0,0.6240,5.7570,98.40,2.3460,4,437.0,21.20,262.76,17.31} | 1 | 15.60
+{1,0.55778,0.00,21.890,0,0.6240,6.3350,98.20,2.1107,4,437.0,21.20,394.67,16.96} | 1 | 18.10
+\.
+
+create function check_elastic_net ()
+returns void as $$
+begin
+    EXECUTE 'drop table if exists house_en, house_en_summary';
+    PERFORM elastic_net_train(
+        'lin_housing_wi',
+        'house_en',
+        'y',
+        'x',
+        'gaussian',
+        1,
+        0.2,
+        True,
+        NULL,
+        'fista',
+        '{eta = 2, max_stepsize = 0.5, use_active_set = f
+   }    1',
+        NULL,
+        2,
+        1e-2
+    );
+
+
+end;
+$$ language plpgsql volatile;
+
+select check_elastic_net();