[madlib] branch master updated: clarify example in user docs for loading model arch

2021-03-04 Thread fmcquillan
This is an automated email from the ASF dual-hosted git repository.

fmcquillan 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 7eeb29c  clarify example in user docs for loading model arch
7eeb29c is described below

commit 7eeb29c6827ff6968e9533536d6f32f8bc6de3c8
Author: Frank McQuillan 
AuthorDate: Thu Mar 4 15:41:33 2021 -0800

clarify example in user docs for loading model arch
---
 .../deep_learning/keras_model_arch_table.sql_in| 46 +-
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git 
a/src/ports/postgres/modules/deep_learning/keras_model_arch_table.sql_in 
b/src/ports/postgres/modules/deep_learning/keras_model_arch_table.sql_in
index ee30f94..0c099e0 100644
--- a/src/ports/postgres/modules/deep_learning/keras_model_arch_table.sql_in
+++ b/src/ports/postgres/modules/deep_learning/keras_model_arch_table.sql_in
@@ -237,8 +237,15 @@ output table 'iris_model' from a previous run
 of 'madlib_keras_fit()' :
 
 UPDATE model_arch_library SET model_weights = model_weights FROM iris_model 
WHERE model_id = 2;
+SELECT model_id, name, description, (model_weights IS NOT NULL) AS 
has_model_weights FROM model_arch_library ORDER BY model_id;
 
-To load weights from Keras using a PL/Python function,
+
+ model_id |  name  | description | has_model_weights 
+--++-+---
+1 | Sophie | A simple model  | f
+2 | Maria  | Also a simple model | t
+
+-# To load weights from Keras using a PL/Python function,
 we need to flatten then serialize the weights to store
 as a PostgreSQL binary data type. Byte format is more
 efficient on space and memory compared to a numeric array.
@@ -273,15 +280,16 @@ plpy.execute(load_query, [model.to_json(), weights_bytea])
 $$ language plpythonu;
 -- Call load function
 SELECT load_weights();
--- Check weights loaded OK
-SELECT COUNT(*) FROM model_arch_library WHERE model_weights IS NOT NULL;
+SELECT model_id, name, description, (model_weights IS NOT NULL) AS 
has_model_weights FROM model_arch_library ORDER BY model_id;
 
 
- count
+
- 1
+ model_id |  name  | description | has_model_weights 
+--++-+---
+1 | Sophie | A simple model  | f
+2 | Maria  | Also a simple model | t
+3 | Ella   | Model x | t
 
-Load weights from Keras using psycopg2.  (Psycopg is a PostgreSQL database 
adapter for the
+-# Load weights from Keras using psycopg2.  (Psycopg is a PostgreSQL database 
adapter for the
 Python programming language.) As above we need to flatten then serialize the 
weights to store as a
 PostgreSQL binary data type.  Note that the psycopg2.Binary function used 
below will increase the size of the
 Python object for the weights, so if your model is large it might be better to 
use a PL/Python function as above.
@@ -310,27 +318,29 @@ weights_bytea = psycopg2.Binary(weights1d.tostring())
 query = "SELECT madlib.load_keras_model('model_arch_library', %s,%s)"
 cur.execute(query,[model.to_json(),weights_bytea])
 conn.commit()
-
-From SQL check if weights loaded OK:
-
-SELECT COUNT(*) FROM model_arch_library WHERE model_weights IS NOT NULL;
+SELECT model_id, name, description, (model_weights IS NOT NULL) AS 
has_model_weights FROM model_arch_library ORDER BY model_id;
 
 
- count
+
- 2
+ model_id |  name  | description | has_model_weights 
+--++-+---
+1 | Sophie | A simple model  | f
+2 | Maria  | Also a simple model | t
+3 | Ella   | Model x | t
+4 | Grace  | Model y | t
 
 -# Delete one of the models:
 
 SELECT madlib.delete_keras_model('model_arch_library',   -- Output table
   1  -- Model id
 );
-SELECT COUNT(*) FROM model_arch_library;
+SELECT model_id, name, description, (model_weights IS NOT NULL) AS 
has_model_weights FROM model_arch_library ORDER BY model_id;
 
 
- count
+
- 2
+ model_id | name  | description | has_model_weights 
+--+---+-+---
+2 | Maria | Also a simple model | t
+3 | Ella  | Model x | t
+4 | Grace | Model y | t
 
 
 @anchor related



[madlib] branch master updated (4bac900 -> 0b300cb)

2021-03-04 Thread khannaekta
This is an automated email from the ASF dual-hosted git repository.

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


from 4bac900  Docs: Various documentation changes
 add 0b300cb  MLP: Fix bug in weights argument

No new revisions were added by this update.

Summary of changes:
 src/ports/postgres/modules/convex/mlp_igd.py_in|  11 +-
 src/ports/postgres/modules/convex/test/mlp.sql_in  | 117 +
 .../modules/convex/utils_regularization.py_in  |   9 +-
 3 files changed, 130 insertions(+), 7 deletions(-)