You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@madlib.apache.org by GitBox <gi...@apache.org> on 2020/05/27 19:52:46 UTC

[GitHub] [madlib] fmcquillan99 edited a comment on pull request #501: DL: Add object table info in load MST table utility

fmcquillan99 edited a comment on pull request #501:
URL: https://github.com/apache/madlib/pull/501#issuecomment-634904316


   (1)
   no custom functions but specify object table
   
   ```
   DROP TABLE IF EXISTS mst_table, mst_table_summary;
   
   SELECT madlib.load_model_selection_table('model_arch_library', -- model architecture table
                                            'mst_table',          -- model selection table output
                                             ARRAY[1,2],              -- model ids from model architecture table
                                             ARRAY[                   -- compile params
                                                 $$loss='categorical_crossentropy',optimizer='Adam(lr=0.1)',metrics=['accuracy']$$,
                                                 $$loss='categorical_crossentropy', optimizer='Adam(lr=0.01)',metrics=['accuracy']$$,
                                                 $$loss='categorical_crossentropy',optimizer='Adam(lr=0.001)',metrics=['accuracy']$$
                                             ],
                                             ARRAY[                    -- fit params
                                                 $$batch_size=4,epochs=1$$,
                                                 $$batch_size=8,epochs=1$$
                                             ],
                                             'test_custom_function_table'
                                            );
                                     
   SELECT * FROM mst_table_summary;
   
     model_arch_table  |        object_table        
   --------------------+----------------------------
    model_arch_library | test_custom_function_table
   (1 row)
   ```
   OK
   
   
   (2)
   custom functions and right object table
   
   ```
   DROP TABLE IF EXISTS mst_table, mst_table_summary;
   
   SELECT madlib.load_model_selection_table('model_arch_library', -- model architecture table
                                            'mst_table',          -- model selection table output
                                             ARRAY[1,2],              -- model ids from model architecture table
                                             ARRAY[                   -- compile params
                                                 $$loss=sum_fn,optimizer='Adam(lr=0.1)',metrics=['accuracy']$$,
                                                 $$loss=mult_fn, optimizer='Adam(lr=0.01)',metrics=['accuracy']$$,
                                                 $$loss='categorical_crossentropy',optimizer='Adam(lr=0.001)',metrics=['accuracy']$$
                                             ],
                                             ARRAY[                    -- fit params
                                                 $$batch_size=4,epochs=1$$,
                                                 $$batch_size=8,epochs=1$$
                                             ],
                                             'test_custom_function_table'
                                            );
   
   SELECT * FROM mst_table_summary;
   
     model_arch_table  |        object_table        
   --------------------+----------------------------
    model_arch_library | test_custom_function_table
   (1 row)
   ```
   OK
   
   
   (3)
   custom functions and wrong object table
   
   ```
   DROP TABLE IF EXISTS mst_table, mst_table_summary;
   
   SELECT madlib.load_model_selection_table('model_arch_library', -- model architecture table
                                            'mst_table',          -- model selection table output
                                             ARRAY[1,2],              -- model ids from model architecture table
                                             ARRAY[                   -- compile params
                                                 $$loss=sum_fn,optimizer='Adam(lr=0.1)',metrics=['accuracy']$$,
                                                 $$loss=mult_fn, optimizer='Adam(lr=0.01)',metrics=['accuracy']$$,
                                                 $$loss='categorical_crossentropy',optimizer='Adam(lr=0.001)',metrics=['accuracy']$$
                                             ],
                                             ARRAY[                    -- fit params
                                                 $$batch_size=4,epochs=1$$,
                                                 $$batch_size=8,epochs=1$$
                                             ],
                                             'test_custom_function_table111'
                                            );
   
   ERROR:  plpy.Error: load_model_selection_table error: Input table 'test_custom_function_table111' does not exist. (plpython.c:5038)
   CONTEXT:  Traceback (most recent call last):
     PL/Python function "load_model_selection_table", line 21, in <module>
       mst_loader = madlib_keras_model_selection.MstLoader(**globals())
     PL/Python function "load_model_selection_table", line 42, in wrapper
     PL/Python function "load_model_selection_table", line 74, in __init__
     PL/Python function "load_model_selection_table", line 459, in __init__
     PL/Python function "load_model_selection_table", line 462, in _validate_input_args
     PL/Python function "load_model_selection_table", line 535, in _validate_input_output_tables
     PL/Python function "load_model_selection_table", line 619, in input_tbl_valid
   PL/Python function "load_model_selection_table"
   ```
   OK
   
   
   (4)
   custom functions specified but not in object table
   
   ```
   DROP TABLE IF EXISTS mst_table, mst_table_summary;
   
   SELECT madlib.load_model_selection_table('model_arch_library', -- model architecture table
                                            'mst_table',          -- model selection table output
                                             ARRAY[1,2],              -- model ids from model architecture table
                                             ARRAY[                   -- compile params
                                                 $$loss=sum_fn111,optimizer='Adam(lr=0.1)',metrics=['accuracy']$$,
                                                 $$loss=mult_fn, optimizer='Adam(lr=0.01)',metrics=['accuracy']$$,
                                                 $$loss='categorical_crossentropy',optimizer='Adam(lr=0.001)',metrics=['accuracy']$$
                                             ],
                                             ARRAY[                    -- fit params
                                                 $$batch_size=4,epochs=1$$,
                                                 $$batch_size=8,epochs=1$$
                                             ],
                                             'test_custom_function_table'
                                            );
   
   ERROR:  plpy.Error: Compile param check failed for: loss=sum_fn111,optimizer='Adam(lr=0.1)',metrics=['accuracy'] (plpython.c:5038)
   DETAIL:  
   
                       custom function 'sum_fn111' used in compile params not defined in object table 'test_custom_function_table'!
   CONTEXT:  Traceback (most recent call last):
     PL/Python function "load_model_selection_table", line 21, in <module>
       mst_loader = madlib_keras_model_selection.MstLoader(**globals())
     PL/Python function "load_model_selection_table", line 42, in wrapper
     PL/Python function "load_model_selection_table", line 74, in __init__
     PL/Python function "load_model_selection_table", line 459, in __init__
     PL/Python function "load_model_selection_table", line 464, in _validate_input_args
     PL/Python function "load_model_selection_table", line 530, in _validate_compile_and_fit_params
   PL/Python function "load_model_selection_table"
   ```
   OK
   
   
   (5) 
   should throw error if specify custom functions but do not specify an object table
   
   ```
   DROP TABLE IF EXISTS mst_table, mst_table_summary;
   
   SELECT madlib.load_model_selection_table('model_arch_library', -- model architecture table
                                            'mst_table',          -- model selection table output
                                             ARRAY[1,2],              -- model ids from model architecture table
                                             ARRAY[                   -- compile params
                                                 $$loss=sum_fn,optimizer='Adam(lr=0.1)',metrics=['accuracy']$$,
                                                 $$loss=mult_fn, optimizer='Adam(lr=0.01)',metrics=['accuracy']$$,
                                                 $$loss='categorical_crossentropy',optimizer='Adam(lr=0.001)',metrics=['accuracy']$$
                                             ],
                                             ARRAY[                    -- fit params
                                                 $$batch_size=4,epochs=1$$,
                                                 $$batch_size=8,epochs=1$$
                                             ]
                                            );
   
    ERROR:  plpy.Error: Compile param check failed for: loss=sum_fn,optimizer='Adam(lr=0.1)',metrics=['accuracy'] (plpython.c:5038)
   DETAIL:  
   
                       custom function 'sum_fn' used in compile params but input object table missing!
   CONTEXT:  Traceback (most recent call last):
     PL/Python function "load_model_selection_table", line 21, in <module>
       mst_loader = madlib_keras_model_selection.MstLoader(**globals())
     PL/Python function "load_model_selection_table", line 42, in wrapper
     PL/Python function "load_model_selection_table", line 74, in __init__
     PL/Python function "load_model_selection_table", line 459, in __init__
     PL/Python function "load_model_selection_table", line 464, in _validate_input_args
     PL/Python function "load_model_selection_table", line 530, in _validate_compile_and_fit_params
   PL/Python function "load_model_selection_table"
   
   ```
   OK (This is the one that did not work before but seems fine now.)
   
   LGTM


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org