From 4d277d750d4fff9e00d89ae6533327d0b5ec2a0c Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Fri, 3 Jul 2020 07:49:53 +0800 Subject: [PATCH] Relax linear test. (#5849) * Increased error in coordinate is mostly due to floating point error. * Shotgun uses Hogwild!, which is non-deterministic and can have even greater floating point error. --- tests/python/test_linear.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/python/test_linear.py b/tests/python/test_linear.py index 0db52d2fa..eaf0e86a1 100644 --- a/tests/python/test_linear.py +++ b/tests/python/test_linear.py @@ -32,7 +32,7 @@ class TestLinear: param.update(coord_param) param = dataset.set_params(param) result = train_result(param, dataset.get_dmat(), num_rounds)['train'][dataset.metric] - assert tm.non_increasing(result) + assert tm.non_increasing(result, 5e-4) # Loss is not guaranteed to always decrease because of regularisation parameters # We test a weaker condition that the loss has not increased between the first and last @@ -65,7 +65,7 @@ class TestLinear: sampled_result[-1] = result[-1] # make sure the last one is used else: sampled_result = result - assert tm.non_increasing(sampled_result) + assert tm.non_increasing(sampled_result, 1e-3) @given(parameter_strategy, strategies.integers(10, 50), tm.dataset_strategy, strategies.floats(1e-5, 2.0),