Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI with latest xgboost #257

Merged
merged 3 commits into from
Jan 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion xgboost_ray/tests/test_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ def objective(labels, predt):
return objective


def get_basescore(model: xgb.XGBModel) -> float:
"""Get base score from an XGBoost sklearn estimator."""
base_score = float(
json.loads(model.get_booster().save_config())["learner"][
"learner_model_param"]["base_score"])
return base_score


class TemporaryDirectory(object):
"""Context manager for tempfile.mkdtemp()"""

Expand Down Expand Up @@ -628,7 +636,8 @@ def test_sklearn_get_default_params(self):
cls = RayXGBClassifier()
assert cls.get_params()["base_score"] is None
cls.fit(X[:4, ...], y[:4, ...])
assert cls.get_params()["base_score"] is not None
base_score = get_basescore(cls)
np.testing.assert_equal(base_score, 0.5)

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