You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@madlib.apache.org by do...@apache.org on 2021/03/11 17:41:49 UTC

[madlib] branch master updated: Fix flaky keras_evaluate relative-error test

This is an automated email from the ASF dual-hosted git repository.

domino 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 f0298f7  Fix flaky keras_evaluate relative-error test
f0298f7 is described below

commit f0298f7f44111d4b849773a902c09ad233d8516c
Author: Domino Valdano <dv...@pivotal.io>
AuthorDate: Thu Mar 11 12:11:14 2021 -0500

    Fix flaky keras_evaluate relative-error test
    
    This was getting divide-by-zero errors whenever the final training
    loss or metric from the previous iteration was exactly 0
---
 .../modules/deep_learning/test/madlib_keras_evaluate.sql_in  | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in b/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in
index 5eed811..f2f8822 100644
--- a/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in
+++ b/src/ports/postgres/modules/deep_learning/test/madlib_keras_evaluate.sql_in
@@ -110,9 +110,15 @@ SELECT madlib_keras_fit_multiple_model(
 
 DROP TABLE IF EXISTS evaluate_out;
 SELECT madlib_keras_evaluate('cifar_10_multiple_model', 'cifar_10_sample_batched', 'evaluate_out', FALSE, 2);
-SELECT assert(relative_error(e.metric,i.training_metrics_final) < 0.00001 AND
-        relative_error(e.loss,i.training_loss_final)  < 0.00001 AND
-        e.metrics_type = '{accuracy}', 'Evaluate output validation failed.')
+SELECT assert(
+    (
+        (e.metric < 0.00001 AND i.training_metric_final < 0.00001) OR
+         relative_error(e.metric,i.training_metrics_final) < 0.00001
+    ) AND (
+        (e.loss < 0.00001 AND i.training_loss_final < 0.00001) OR
+         relative_error(e.loss,i.training_loss_final)  < 0.00001)
+    ) AND
+         e.metrics_type = '{accuracy}', 'Evaluate output validation failed.')
 FROM evaluate_out e, cifar_10_multiple_model_info i WHERE i.mst_key = 2;