Skip to content
Snippets Groups Projects
Commit a49eed00 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[test] Fix precision test to be a bit softer on floating-point comparisons

parent ef7bb2ed
Branches
Tags
1 merge request!10Fix precision test to be a bit softer on floating-point comparisons
Pipeline #35970 failed
...@@ -116,7 +116,7 @@ def test_training(): ...@@ -116,7 +116,7 @@ def test_training():
previous = Machine(TEST_MACHINE_NO_PROBS) previous = Machine(TEST_MACHINE_NO_PROBS)
nose.tools.eq_(machine.machine_type, previous.machine_type) nose.tools.eq_(machine.machine_type, previous.machine_type)
nose.tools.eq_(machine.kernel_type, previous.kernel_type) nose.tools.eq_(machine.kernel_type, previous.kernel_type)
nose.tools.eq_(machine.gamma, previous.gamma) assert numpy.isclose(machine.gamma, previous.gamma)
nose.tools.eq_(machine.shape, previous.shape) nose.tools.eq_(machine.shape, previous.shape)
assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8) assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8)
assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8) assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8)
...@@ -150,7 +150,7 @@ def test_training_with_probability(): ...@@ -150,7 +150,7 @@ def test_training_with_probability():
previous = Machine(HEART_MACHINE) previous = Machine(HEART_MACHINE)
nose.tools.eq_(machine.machine_type, previous.machine_type) nose.tools.eq_(machine.machine_type, previous.machine_type)
nose.tools.eq_(machine.kernel_type, previous.kernel_type) nose.tools.eq_(machine.kernel_type, previous.kernel_type)
nose.tools.eq_(machine.gamma, previous.gamma) assert numpy.isclose(machine.gamma, previous.gamma)
nose.tools.eq_(machine.shape, previous.shape) nose.tools.eq_(machine.shape, previous.shape)
assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8) assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8)
assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8) assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8)
...@@ -198,7 +198,7 @@ def test_training_one_class(): ...@@ -198,7 +198,7 @@ def test_training_one_class():
previous = Machine(TEST_MACHINE_ONE_CLASS) previous = Machine(TEST_MACHINE_ONE_CLASS)
nose.tools.eq_(machine.machine_type, previous.machine_type) nose.tools.eq_(machine.machine_type, previous.machine_type)
nose.tools.eq_(machine.kernel_type, previous.kernel_type) nose.tools.eq_(machine.kernel_type, previous.kernel_type)
nose.tools.eq_(machine.gamma, previous.gamma) assert numpy.isclose(machine.gamma, previous.gamma)
nose.tools.eq_(machine.shape, previous.shape) nose.tools.eq_(machine.shape, previous.shape)
assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8) assert numpy.all(abs(machine.input_subtract - previous.input_subtract) < 1e-8)
assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8) assert numpy.all(abs(machine.input_divide - previous.input_divide) < 1e-8)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment