Skip to content

Commit

Permalink
GH-15809: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
syzonyuliia-h2o committed Jan 29, 2024
1 parent cbad0f8 commit 026f45d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions h2o-py/tests/testdir_jira/pyunit_pubdev_6413_cv_sd_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
20 changes: 15 additions & 5 deletions h2o-py/tests/testdir_misc/pyunit_metric_json_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 026f45d

Please sign in to comment.