From 03f7f8c8c654878efb37406d1c17b6723dfebbca Mon Sep 17 00:00:00 2001 From: Levs Dolgovs Date: Wed, 3 Mar 2021 16:56:05 -0800 Subject: [PATCH 1/3] switching to absolute tolerances --- python/cuml/test/test_fil.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/cuml/test/test_fil.py b/python/cuml/test/test_fil.py index cf0d024933..ee07142a47 100644 --- a/python/cuml/test/test_fil.py +++ b/python/cuml/test/test_fil.py @@ -138,7 +138,7 @@ def test_fil_classification(n_rows, n_columns, num_rounds, assert array_equal(fil_preds, xgb_preds_int) xgb_proba = np.stack([1-xgb_preds, xgb_preds], axis=1) fil_proba = np.asarray(fm.predict_proba(X_validation)) - assert np.allclose(fil_proba, xgb_proba, 1e-3) + assert np.allclose(fil_proba, xgb_proba, atol=3e-7) @pytest.mark.parametrize('n_rows', [unit_param(1000), quality_param(10000), @@ -262,7 +262,7 @@ def test_fil_skl_classification(n_rows, n_columns, n_estimators, max_depth, assert array_equal(fil_preds, skl_preds_int) fil_proba = np.asarray(fm.predict_proba(X_validation)) fil_proba = np.reshape(fil_proba, np.shape(skl_proba)) - assert np.allclose(fil_proba, skl_proba, 1e-3) + assert np.allclose(fil_proba, skl_proba, atol=3e-7) @pytest.mark.parametrize('n_rows', [1000]) @@ -486,8 +486,8 @@ def test_lightgbm(tmp_path, num_classes): algo='TREE_REORG', output_class=True, model_type="lightgbm") - fil_proba = fm.predict_proba(X) - assert np.allclose(gbm_proba, fil_proba[:, 1], 1e-2) + fil_proba = fm.predict_proba(X)[:, 1] + assert np.allclose(gbm_proba, fil_proba, atol=1e-7) gbm_preds = (gbm_proba > 0.5) fil_preds = fm.predict(X) assert array_equal(gbm_preds, fil_preds) From 0c429c5a9ebba161c00304901f121120e7b02d63 Mon Sep 17 00:00:00 2001 From: Levs Dolgovs Date: Wed, 3 Mar 2021 17:30:36 -0800 Subject: [PATCH 2/3] copyright year --- python/cuml/test/test_fil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cuml/test/test_fil.py b/python/cuml/test/test_fil.py index ee07142a47..f1483fb26a 100644 --- a/python/cuml/test/test_fil.py +++ b/python/cuml/test/test_fil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019, NVIDIA CORPORATION. +# Copyright (c) 2019-2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 4e61c31e47f9ed6f6956638c952adb4f2d8fc2ae Mon Sep 17 00:00:00 2001 From: Levs Dolgovs Date: Thu, 4 Mar 2021 19:43:12 -0800 Subject: [PATCH 3/3] unify thresholds as per @canonizer's suggestion --- python/cuml/test/test_fil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cuml/test/test_fil.py b/python/cuml/test/test_fil.py index f1483fb26a..cd4f03a1de 100644 --- a/python/cuml/test/test_fil.py +++ b/python/cuml/test/test_fil.py @@ -487,7 +487,7 @@ def test_lightgbm(tmp_path, num_classes): output_class=True, model_type="lightgbm") fil_proba = fm.predict_proba(X)[:, 1] - assert np.allclose(gbm_proba, fil_proba, atol=1e-7) + assert np.allclose(gbm_proba, fil_proba, atol=3e-7) gbm_preds = (gbm_proba > 0.5) fil_preds = fm.predict(X) assert array_equal(gbm_preds, fil_preds)