Skip to content

Commit

Permalink
default to no split.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Nov 22, 2024
1 parent c9947c6 commit dfb5cae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python-package/xgboost/dask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ def __init__(
self,
*,
objective: str = "rank:pairwise",
allow_group_split: bool = True,
allow_group_split: bool = False,
coll_cfg: Optional[CollConfig] = None,
**kwargs: Any,
) -> None:
Expand Down
3 changes: 3 additions & 0 deletions python-package/xgboost/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ def non_increasing(L: Sequence[float], tolerance: float = 1e-4) -> bool:
return all((y - x) < tolerance for x, y in zip(L, L[1:]))


def non_decreasing(L: Sequence[float], tolerance: float = 1e-4) -> bool:
return all((y - x) >= -tolerance for x, y in zip(L, L[1:]))

def predictor_equal(lhs: xgb.DMatrix, rhs: xgb.DMatrix) -> bool:
"""Assert whether two DMatrices contain the same predictors."""
lcsr = lhs.get_data()
Expand Down
10 changes: 8 additions & 2 deletions tests/test_distributed/test_with_dask/test_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def test_dask_ranking(client: Client) -> None:
qid_test = qid_test.astype(np.uint32)

rank = dxgb.DaskXGBRanker(
n_estimators=2500, eval_metric=["ndcg"], early_stopping_rounds=10
n_estimators=2500,
eval_metric=["ndcg"],
early_stopping_rounds=10,
allow_group_split=True,
)
rank.fit(
x_train,
Expand All @@ -88,4 +91,7 @@ def test_no_group_split(client: Client) -> None:
eval_qid=[q_tr, q_va],
verbose=True,
)
print(X_tr.shape, X_tr.columns)

assert ltr.n_features_in_ == 128
assert X_tr.shape[1] == ltr.n_features_in_ # no change
assert tm.non_decreasing(ltr.evals_result()["validation_0"]["ndcg@32"])

0 comments on commit dfb5cae

Please sign in to comment.