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.
This commit is contained in:
Jiaming Yuan 2020-07-03 07:49:53 +08:00 committed by GitHub
parent eb067c1c34
commit 4d277d750d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ class TestLinear:
param.update(coord_param) param.update(coord_param)
param = dataset.set_params(param) param = dataset.set_params(param)
result = train_result(param, dataset.get_dmat(), num_rounds)['train'][dataset.metric] 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 # 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 # 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 sampled_result[-1] = result[-1] # make sure the last one is used
else: else:
sampled_result = result sampled_result = result
assert tm.non_increasing(sampled_result) assert tm.non_increasing(sampled_result, 1e-3)
@given(parameter_strategy, strategies.integers(10, 50), @given(parameter_strategy, strategies.integers(10, 50),
tm.dataset_strategy, strategies.floats(1e-5, 2.0), tm.dataset_strategy, strategies.floats(1e-5, 2.0),