Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

Commit 97c67ca

Browse files
authored
Fix CI with latest xgboost (#257)
* Fix CI with latest xgboost Signed-off-by: Antoni Baum <antoni.baum@protonmail.com> * trigger CI * Update github actions to v3 Signed-off-by: Antoni Baum <antoni.baum@protonmail.com> Signed-off-by: Antoni Baum <antoni.baum@protonmail.com>
1 parent 20be813 commit 97c67ca

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

.github/workflows/gpu.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
runs-on: ubuntu-latest
99
timeout-minutes: 20
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212
- name: Set up Python 3.7
13-
uses: actions/setup-python@v2
13+
uses: actions/setup-python@v3
1414
with:
1515
python-version: 3.7
1616
- name: Install dependencies

.github/workflows/test.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 3
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
- name: Set up Python 3.7
16-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v3
1717
with:
1818
python-version: 3.7
1919
- name: Install dependencies
@@ -42,9 +42,9 @@ jobs:
4242
- python-version: 3.9
4343
ray-wheel: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp39-cp39-manylinux2014_x86_64.whl
4444
steps:
45-
- uses: actions/checkout@v2
45+
- uses: actions/checkout@v3
4646
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v2
47+
uses: actions/setup-python@v3
4848
with:
4949
python-version: ${{ matrix.python-version }}
5050
- name: Install dependencies
@@ -79,9 +79,9 @@ jobs:
7979
matrix:
8080
python-version: [3.7, 3.8, 3.9]
8181
steps:
82-
- uses: actions/checkout@v2
82+
- uses: actions/checkout@v3
8383
- name: Set up Python ${{ matrix.python-version }}
84-
uses: actions/setup-python@v2
84+
uses: actions/setup-python@v3
8585
with:
8686
python-version: ${{ matrix.python-version }}
8787
- name: Install dependencies
@@ -118,9 +118,9 @@ jobs:
118118
matrix:
119119
python-version: [3.7, 3.8, 3.9]
120120
steps:
121-
- uses: actions/checkout@v2
121+
- uses: actions/checkout@v3
122122
- name: Set up Python ${{ matrix.python-version }}
123-
uses: actions/setup-python@v2
123+
uses: actions/setup-python@v3
124124
with:
125125
python-version: ${{ matrix.python-version }}
126126
- name: Install dependencies
@@ -169,9 +169,9 @@ jobs:
169169
- python-version: 3.9
170170
ray-wheel: https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-3.0.0.dev0-cp39-cp39-manylinux2014_x86_64.whl
171171
steps:
172-
- uses: actions/checkout@v2
172+
- uses: actions/checkout@v3
173173
- name: Set up Python ${{ matrix.python-version }}
174-
uses: actions/setup-python@v2
174+
uses: actions/setup-python@v3
175175
with:
176176
python-version: ${{ matrix.python-version }}
177177
- name: Install dependencies
@@ -187,7 +187,7 @@ jobs:
187187
run: |
188188
python -m pip install -e .
189189
- name: Clone XGBoost repo
190-
uses: actions/checkout@v2
190+
uses: actions/checkout@v3
191191
with:
192192
repository: dmlc/xgboost
193193
path: xgboost
@@ -224,9 +224,9 @@ jobs:
224224
matrix:
225225
python-version: [3.7]
226226
steps:
227-
- uses: actions/checkout@v2
227+
- uses: actions/checkout@v3
228228
- name: Set up Python ${{ matrix.python-version }}
229-
uses: actions/setup-python@v2
229+
uses: actions/setup-python@v3
230230
with:
231231
python-version: ${{ matrix.python-version }}
232232
- name: Install dependencies

xgboost_ray/tests/test_sklearn.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ def objective(labels, predt):
7676
return objective
7777

7878

79+
def get_basescore(model: xgb.XGBModel) -> float:
80+
"""Get base score from an XGBoost sklearn estimator."""
81+
base_score = float(
82+
json.loads(model.get_booster().save_config())["learner"][
83+
"learner_model_param"]["base_score"])
84+
return base_score
85+
86+
7987
class TemporaryDirectory(object):
8088
"""Context manager for tempfile.mkdtemp()"""
8189

@@ -628,7 +636,8 @@ def test_sklearn_get_default_params(self):
628636
cls = RayXGBClassifier()
629637
assert cls.get_params()["base_score"] is None
630638
cls.fit(X[:4, ...], y[:4, ...])
631-
assert cls.get_params()["base_score"] is not None
639+
base_score = get_basescore(cls)
640+
np.testing.assert_equal(base_score, 0.5)
632641

633642
@unittest.skipIf(XGBOOST_VERSION < Version("1.1.0"),
634643
f"not supported in xgb version {xgb.__version__}")

0 commit comments

Comments
 (0)