khannaekta opened a new pull request #503:
URL: https://github.com/apache/madlib/pull/503


   JIRA: https://issues.apache.org/jira/browse/MADLIB-1441
   
   For MADlib deep_learning module to support custom functions, we have the 
following functions are affected:
   1. madlib_keras_fit()
   2. madlib_keras_fit_multiple_model()
   3. madlib_keras_evaluate()
   Currently the compile_param passed in are like
    `optimizer=SGD(lr=0.01, decay=1e-6, nesterov=True), 
loss='categorical_crossentropy', metrics=['mae']`
   For a custom function we would just pass in as follows:
    `optimizer=SGD(lr=0.01, decay=1e-6, nesterov=True), loss=custom_fn1, 
metrics=['mae']` 
   
   Object table definition with a dill object of custom functions is as follows:
   |id|name|description|function|
   |---|---|---|---|
   |1|custom_fn1|test function|\x80026...|
   |2|custom_fn2|test function2|\x8ab26...|
   
   For fit_multiple, we want to support multiple configs in mst_table with a 
mix of custom and keras loss functions:
   |mst_key|model_id|compile_params|fit_params|
   |---|---|---|---|
   |2|1|loss='custom_fn1', optimizer=....|batch_size=16, epochs=1|
   |3|1|loss='custom_fn2', optimizer=....|batch_size=16, epochs=1|
   |1|1|loss='categorical_crossentropy', optimizer=....|batch_size=16, epochs=1|
   
   Following are the relevant API Changes
    **Fit**: add a new optional param for passing in the object_table name
    object_table (optional) VARCHAR: Name of the table containing Python 
objects in the case that custom loss functions or custom metrics are specified 
in the parameter `compile_params
   ```
   madlib_keras_fit(
       source_table,
       model,
       model_arch_table,
       model_id,
       compile_params,
       fit_params,
       num_iterations,
       use_gpus,
       validation_table,
       metrics_compute_frequency,
       warm_start,
       name,
       description,
       object_table  -- new parameter
       )
   ```
   **Fit_multiple**: No change to the `madlib_keras_fit_multiple_model()` 
function. Reads object_table information from the model_selection table.
    A summary table named <model>_summary is also created, which has the 
following new columns:
   |model_selection_table |Name of the table containing model selection 
parameters to be tried.|
   |object_table| Name of the object table containing the serialized Python 
objects for custom loss functions and custom metrics (read from the mst_summary 
table).|
   
   **Evaluate**: No change to the `madlib_keras_evaluate()` function. Reads 
object_table information from the model table. Output table adds a new column
   |loss_type|Type of loss used that was used in the training step
    If a custom loss or metric is used, we should give the name of it. 
Otherwise list the built-in one used|
   <!--  
   
   Thanks for sending a pull request!  Here are some tips for you:
   1. Refer to this link for contribution guidelines 
https://cwiki.apache.org/confluence/display/MADLIB/Contribution+Guidelines
   2. Please Provide the Module Name, a JIRA Number and a short description 
about your changes.
   -->
   
   - [ ] Add the module name, JIRA# to PR/commit and description.
   - [ ] Add tests for the change. 
   
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to