From eb0b133ea760cd3806c63cc6402525276866f8ac Mon Sep 17 00:00:00 2001 From: syzonyuliia Date: Mon, 29 Jan 2024 16:51:20 +0100 Subject: [PATCH] GH-15809: fix tests --- .../pyunit_pubdev_6413_cv_sd_fix.py | 2 ++ .../testdir_misc/pyunit_metric_json_check.py | 20 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/h2o-py/tests/testdir_jira/pyunit_pubdev_6413_cv_sd_fix.py b/h2o-py/tests/testdir_jira/pyunit_pubdev_6413_cv_sd_fix.py index 247604c1a235..8912db6cbe91 100644 --- a/h2o-py/tests/testdir_jira/pyunit_pubdev_6413_cv_sd_fix.py +++ b/h2o-py/tests/testdir_jira/pyunit_pubdev_6413_cv_sd_fix.py @@ -50,6 +50,8 @@ def assertMeanSDCalculation(meanCol, stdCol, cvVals, tol=1e-6): xsum += temp xsumSquare += temp*temp xmean = xsum/nfolds + if math.isnan(xmean) and math.isnan(float(meanCol[itemIndex])): + continue assert abs(xmean-float(meanCol[itemIndex])) < tol, "Expected mean: {0}, Actual mean: {1}".format(xmean, float(meanCol[itemIndex])) xstd = math.sqrt((xsumSquare-nfolds*xmean*xmean)*oneOverNm1) assert abs(xstd-float(stdCol[itemIndex])) < tol, "Expected SD: {0}, Actual SD: {1}".format(xstd, float(stdCol[itemIndex])) diff --git a/h2o-py/tests/testdir_misc/pyunit_metric_json_check.py b/h2o-py/tests/testdir_misc/pyunit_metric_json_check.py index c28dc8148e9f..5564a60c7f96 100644 --- a/h2o-py/tests/testdir_misc/pyunit_metric_json_check.py +++ b/h2o-py/tests/testdir_misc/pyunit_metric_json_check.py @@ -36,7 +36,9 @@ def metric_json_check(): u'nobs', u'mean_residual_deviance', u'custom_metric_name', - u'custom_metric_value'] + u'custom_metric_value', + u'loglikelihood', + u'AIC'] reg_metric_diff = list(set(reg_metric_json_keys_have) - set(reg_metric_json_keys_desired)) assert not reg_metric_diff, "There's a difference between the current ({0}) and the desired ({1}) regression " \ "metric json. The difference is {2}".format(reg_metric_json_keys_have, @@ -72,7 +74,9 @@ def metric_json_check(): u'residual_deviance', u'mean_residual_deviance', u'custom_metric_name', - u'custom_metric_value'] + u'custom_metric_value', + u'loglikelihood', + u'AIC'] reg_metric_diff = list(set(reg_metric_json_keys_have) - set(reg_metric_json_keys_desired)) assert not reg_metric_diff, "There's a difference between the current ({0}) and the desired ({1}) glm-regression " \ "metric json. The difference is {2}".format(reg_metric_json_keys_have, @@ -111,7 +115,9 @@ def metric_json_check(): u'domain', u'custom_metric_name', u'custom_metric_value', - u'pr_auc'] + u'pr_auc', + u'loglikelihood', + u'AIC'] bin_metric_diff = list(set(bin_metric_json_keys_have) - set(bin_metric_json_keys_desired)) assert not bin_metric_diff, "There's a difference between the current ({0}) and the desired ({1}) binomial " \ "metric json. The difference is {2}".format(bin_metric_json_keys_have, @@ -154,7 +160,9 @@ def metric_json_check(): u'domain', u'custom_metric_name', u'custom_metric_value', - u'pr_auc'] + u'pr_auc', + u'loglikelihood', + u'AIC'] bin_metric_diff = list(set(bin_metric_json_keys_have) - set(bin_metric_json_keys_desired)) assert not bin_metric_diff, "There's a difference between the current ({0}) and the desired ({1}) glm-binomial " \ "metric json. The difference is {2}".format(bin_metric_json_keys_have, @@ -194,7 +202,9 @@ def metric_json_check(): u'duration_in_ms', u'frame_checksum', u'custom_metric_name', - u'custom_metric_value'] + u'custom_metric_value', + u'loglikelihood', + u'AIC'] mul_metric_diff = list(set(mul_metric_json_keys_have) - set(mul_metric_json_keys_desired)) assert not mul_metric_diff, "There's a difference between the current ({0}) and the desired ({1}) multinomial " \ "metric json. The difference is {2}".format(mul_metric_json_keys_have,