Skip to content

Commit

Permalink
Avoid unit test failures with newer sklearn
Browse files Browse the repository at this point in the history
  • Loading branch information
mgalardini committed Jun 24, 2024
1 parent c59619f commit 499e7a5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/input_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,24 @@ def test_load_structure(self):
0.14715874, 0.26079721, 0.40212166,
0.01363621, 0.4692565 , -0.91867928, -0.80314748,
0.12924261])
# scikit-learn >= 1.5.0 gives different results still
tr2 = np.array([-0.77358649, 0.27808873, -0.66410947, 0.15156241, 0.64312006])
tc2 = np.array([-0.77358649, -0.34210166, -0.20470446, 0.68840152, 0.64905702,
0.10738983, -0.2647525 , -0.22611827, 1. , -0.7949316 ,
0.70578587, -0.43893806, -0.15941077, 0.63665674, 0.37763782,
-0.58174628, -0.19797499, 0.5000248 , -0.74400678, -0.1875957])
try:
self.assertTrue(abs((t.values[0] - tr).max()) < 1E-7)
self.assertTrue(abs((t.values[:,0] - tc).max()) < 1E-7)
except AssertionError:
# scikit-learn >= 0.20.0 gives different results
self.assertTrue(abs((t.values[0] - tr1).max()) < 1E-7)
self.assertTrue(abs((t.values[:,0] - tc1).max()) < 1E-7)
try:
# scikit-learn >= 0.20.0 gives different results
self.assertTrue(abs((t.values[0] - tr1).max()) < 1E-7)
self.assertTrue(abs((t.values[:,0] - tc1).max()) < 1E-7)
except AssertionError:
# scikit-learn >= 1.5.0 gives different results still
self.assertTrue(abs((t.values[0] - tr2).max()) < 1E-7)
self.assertTrue(abs((t.values[:,0] - tc2).max()) < 1E-7)
t = load_structure(M, p, 5, 'metric', 1, 42)
tr = np.array([-0.97249805, -0.24747933, 0.49918088,
-0.04765291, 0.34207924])
Expand Down

0 comments on commit 499e7a5

Please sign in to comment.