[ 
https://issues.apache.org/jira/browse/MADLIB-1336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16854969#comment-16854969
 ] 

Ekta Khanna commented on MADLIB-1336:
-------------------------------------

Merged as part of PR: [https://github.com/apache/madlib/pull/385]

> Some compile and fit parameters not being passed properly to Keras 
> -------------------------------------------------------------------
>
>                 Key: MADLIB-1336
>                 URL: https://issues.apache.org/jira/browse/MADLIB-1336
>             Project: Apache MADlib
>          Issue Type: Bug
>          Components: Module: Neural Networks
>            Reporter: Frank McQuillan
>            Priority: Major
>             Fix For: v1.16
>
>
> I suggest that we support the optional / mandatory rules of the underlying 
> Keras compile and fit parameters.
> (1) I did not use a metrics parameter and it failed:
> {code}
> SELECT madlib.madlib_keras_fit('mnist_train_packed',  -- source_table
>                                'model1', -- model
>                                'dependent_var',  -- dependent_varname
>                                'independent_var',  -- independent_varname
>                                'model_arch_library',  -- model_arch_table
>                                2,  -- model_arch_id
>                                $$ loss='categorical_crossentropy', 
> optimizer='adam' $$,  -- compile_params
>                                $$ batch_size=128, epochs=4 $$,  -- fit_params
>                                1,  -- num_iterations
>                                FALSE,  -- use_gpu
>                                NULL,  -- validation_table
>                                'Frank',  -- name
>                                'A test model'  -- description
>                               );
> {code}
> produces
> {code}
> InternalError: (psycopg2.InternalError) plpy.SPIError: KeyError: 'metrics' 
> (plpython.c:5038)  (seg0 slice1 10.128.0.41:40000 pid=31836) (plpython.c:5038)
> DETAIL:  
> Traceback (most recent call last):
>   PL/Python function "fit_transition", line 6, in <module>
>     return madlib_keras.fit_transition(**globals())
>   PL/Python function "fit_transition", line 388, in fit_transition
>   PL/Python function "fit_transition", line 71, in compile_and_set_weights
>   PL/Python function "fit_transition", line 241, in compile_model
>   PL/Python function "fit_transition", line 144, in 
> parse_and_validate_compile_params
>   PL/Python function "fit_transition", line 247, in 
> validate_compile_param_types
> PL/Python function "fit_transition"
> CONTEXT:  Traceback (most recent call last):
>   PL/Python function "madlib_keras_fit", line 21, in <module>
>     madlib_keras.fit(**globals())
>   PL/Python function "madlib_keras_fit", line 157, in fit
> PL/Python function "madlib_keras_fit"
>  [SQL: "SELECT madlib.madlib_keras_fit('mnist_train_packed',  -- 
> source_table\n                               'model1', -- model\n             
>                   'dependent_var',  -- dependent_varname\n                    
>            'independent_var',  -- independent_varname\n                       
>         'model_arch_library',  -- model_arch_table\n                          
>      2,  -- model_arch_id\n                               $$ 
> loss='categorical_crossentropy', optimizer='adam' $$,  -- compile_params\n    
>                            $$ batch_size=128, epochs=4 $$,  -- fit_params\n   
>                             1,  -- num_iterations\n                           
>     FALSE,  -- use_gpu\n                               NULL,  -- 
> validation_table\n                               'Frank',  -- name\n          
>                      'A test model'  -- description\n                         
>      );"]
> {code}
> (2)  Errors on loss parameter which is optional:
> {code}
> madlib=# SELECT madlib.madlib_keras_fit('mnist_train_packed',  -- source_table
> madlib(#                                'model1', -- model
> madlib(#                                'dependent_var',  -- dependent_varname
> madlib(#                                'independent_var',  -- 
> independent_varname
> madlib(#                                'model_arch_library',  -- 
> model_arch_table
> madlib(#                                2,  -- model_arch_id
> madlib(#                                $$ optimizer='adam' $$,  -- 
> compile_params
> madlib(#                                $$ $$,  -- fit_params
> madlib(#                                1,  -- num_iterations
> madlib(#                                FALSE,  -- use_gpu
> madlib(#                                NULL,  -- validation_table
> madlib(#                                'Frank',  -- name
> madlib(#                                'A test model'  -- description
> madlib(#                               );
> INFO:  Model architecture size: 1KB
> CONTEXT:  PL/Python function "madlib_keras_fit"
> INFO:  Model state (serialized) size: 2MB
> CONTEXT:  PL/Python function "madlib_keras_fit"
> ERROR:  plpy.SPIError: KeyError: 'loss' (plpython.c:5038)  (seg0 slice1 
> 10.128.0.41:40000 pid=1039) (plpython.c:5038)
> DETAIL:  
> Traceback (most recent call last):
>   PL/Python function "fit_transition", line 6, in <module>
>     return madlib_keras.fit_transition(**globals())
>   PL/Python function "fit_transition", line 388, in fit_transition
>   PL/Python function "fit_transition", line 71, in compile_and_set_weights
>   PL/Python function "fit_transition", line 241, in compile_model
>   PL/Python function "fit_transition", line 136, in 
> parse_and_validate_compile_params
>   PL/Python function "fit_transition", line 187, in parse_loss
> PL/Python function "fit_transition"
> CONTEXT:  Traceback (most recent call last):
>   PL/Python function "madlib_keras_fit", line 21, in <module>
> {code}
> (3)  All fit params are optional so should be able to pass NULL
> {code}
> madlib=# SELECT madlib.madlib_keras_fit('mnist_train_packed',  -- source_table
> madlib(#                                'model1', -- model
> madlib(#                                'dependent_var',  -- dependent_varname
> madlib(#                                'independent_var',  -- 
> independent_varname
> madlib(#                                'model_arch_library',  -- 
> model_arch_table
> madlib(#                                2,  -- model_arch_id
> madlib(#                                $$ optimizer='adam' $$,  -- 
> compile_params
> madlib(#                                NULL,  -- fit_params
> madlib(#                                1,  -- num_iterations
> madlib(#                                FALSE,  -- use_gpu
> madlib(#                                NULL,  -- validation_table
> madlib(#                                'Frank',  -- name
> madlib(#                                'A test model'  -- description
> madlib(#                               );
> ERROR:  TypeError: cannot concatenate 'str' and 'NoneType' objects 
> (plpython.c:5038)
> CONTEXT:  Traceback (most recent call last):
>   PL/Python function "madlib_keras_fit", line 21, in <module>
>     madlib_keras.fit(**globals())
>   PL/Python function "madlib_keras_fit", line 127, in fit
> PL/Python function "madlib_keras_fit"
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to