From 499e7a5e67eee60cde66acfb1cb790dda1fce0c2 Mon Sep 17 00:00:00 2001 From: Marco Galardini Date: Mon, 24 Jun 2024 15:42:50 +0200 Subject: [PATCH 1/4] Avoid unit test failures with newer sklearn --- tests/input_test.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/input_test.py b/tests/input_test.py index 712787f..4607864 100644 --- a/tests/input_test.py +++ b/tests/input_test.py @@ -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]) From c1158dfd86d663336eac5887da1077a1252dc37c Mon Sep 17 00:00:00 2001 From: Marco Galardini Date: Mon, 24 Jun 2024 15:49:57 +0200 Subject: [PATCH 2/4] Try to fix GH actions test errors --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8314222..041d56f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ DendroPy>=4.4.0 -git+https://github.com/johnlees/glmnet_python.git matplotlib>=3.0.0 numpy>=1.15.2 pandas>=0.23.4 From 6be3916b177d777795ca46bf434d8682134ccb0e Mon Sep 17 00:00:00 2001 From: Marco Galardini Date: Mon, 24 Jun 2024 15:53:44 +0200 Subject: [PATCH 3/4] Another test --- .github/workflows/azure_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure_ci.yml b/.github/workflows/azure_ci.yml index 5880ea0..9ae5bff 100644 --- a/.github/workflows/azure_ci.yml +++ b/.github/workflows/azure_ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8] + python-version: [3.12] steps: - uses: actions/checkout@v2 From df11fa3e63c7dab25f86c358ee4763d47e06c3ba Mon Sep 17 00:00:00 2001 From: Marco Galardini Date: Tue, 25 Jun 2024 14:45:07 +0200 Subject: [PATCH 4/4] Patch github actions failure with glmnet_py Unclear what is the underlying cause of the error, but downgrading glmnet_py to 1.0.0 fixed the issue --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index a41c635..0876546 100644 --- a/environment.yml +++ b/environment.yml @@ -13,7 +13,7 @@ dependencies: - pandas - statsmodels >=0.10 - scikit-learn - - glmnet_py + - conda-forge::glmnet_py !=1.0.1,!=1.0.2 # avoids errors in GH actions - pysam >=0.15.3 - dendropy >=4.4.0 - matplotlib-base