From 297134f1da8d1c50fd8f296020b7ee894f2429db Mon Sep 17 00:00:00 2001 From: Keith Battocchi Date: Wed, 6 Nov 2024 01:02:51 -0500 Subject: [PATCH] Migrate to macos-latest Signed-off-by: Keith Battocchi --- .github/workflows/ci.yml | 13 ++++++++++--- econml/tests/test_grf_python.py | 10 +++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78a82c976..f924f6457 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -203,13 +203,16 @@ jobs: if: ${{ needs.eval.outputs.testCode == 'True' }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-12] + os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] kind: [serial, other, dml, main, treatment, ray] exclude: # Serial tests fail randomly on mac sometimes, so we don't run them there - - os: macos-12 + - os: macos-latest kind: serial + # Mac ARM doesn't support tensorflow versions compatible with python 3.8 + - os: macos-latest + python-version: '3.8' # Ray tests run out of memory on Windows - os: windows-latest kind: ray @@ -249,6 +252,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + - name: Install libomp + # lightgbm needs libomp on mac + run: brew install libomp + if: matrix.os == 'macos-latest' - name: Install uv # check if we're running on windows run: ${{ runner.os == 'Windows' && 'irm https://astral.sh/uv/install.ps1 | iex' || 'curl -LsSf https://astral.sh/uv/install.sh | sh' }} @@ -299,7 +306,7 @@ jobs: strategy: matrix: kind: [tests] - os: [ubuntu-latest, windows-latest, macos-12] + os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] extras: ["[tf,plt,dowhy,ray]"] include: diff --git a/econml/tests/test_grf_python.py b/econml/tests/test_grf_python.py index 2f4a5a773..3140dad72 100644 --- a/econml/tests/test_grf_python.py +++ b/econml/tests/test_grf_python.py @@ -494,10 +494,10 @@ def test_projection(self,): forest = RegressionForest(**config).fit(X, y) projector = np.ones((X.shape[0], 2)) / 2.0 mean_proj, var_proj = forest.predict_projection_and_var(X, projector) - np.testing.assert_array_equal(mean_proj, mean) - np.testing.assert_array_equal(var_proj, var) - np.testing.assert_array_equal(var_proj, forest.predict_projection_var(X, projector)) - np.testing.assert_array_equal(mean_proj, forest.predict_projection(X, projector)) + np.testing.assert_allclose(mean_proj, mean) + np.testing.assert_allclose(var_proj, var) + np.testing.assert_allclose(var_proj, forest.predict_projection_var(X, projector)) + np.testing.assert_allclose(mean_proj, forest.predict_projection(X, projector)) return def test_feature_importances(self,): @@ -547,7 +547,7 @@ def test_feature_importances(self,): feature_importances /= tw[0] totest = tree.tree_.compute_feature_importances(normalize=False, max_depth=max_depth, depth_decay=2.0) - np.testing.assert_array_equal(feature_importances, totest) + np.testing.assert_allclose(feature_importances, totest) het_importances = np.zeros(n_features) for it, (feat, depth, left, right, w) in\