Skip to content

Commit

Permalink
Disable per-group weight.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Jan 8, 2021
1 parent e2bb82f commit 0474666
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions python-package/xgboost/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ class DaskDMatrix:
Weight for each instance.
base_margin :
Global bias for each instance.
qid :
Query ID for ranking.
label_lower_bound :
Upper bound for survival training.
label_upper_bound :
Expand Down Expand Up @@ -245,6 +247,9 @@ def __init__(
self.feature_types = feature_types
self.missing = missing

if qid is not None and weight is not None:
raise NotImplementedError('per-group weight is not implemented.')

if len(data.shape) != 2:
raise ValueError(
'Expecting 2 dimensional input, got: {shape}'.format(
Expand Down Expand Up @@ -1657,8 +1662,10 @@ def fit( # pylint: disable=arguments-differ
) -> "DaskXGBRanker":
_assert_dask_support()
msg = "Use `qid` instead of `group` on dask interface."
assert group is None and eval_group is None, msg
assert qid is not None, "`qid` is required for ranking."
if not (group is None and eval_group is None):
raise ValueError(msg)
if not (qid is not None):
raise ValueError("`qid` is required for ranking.")
return self.client.sync(
self._fit_async,
X=X,
Expand Down
8 changes: 4 additions & 4 deletions python-package/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1352,10 +1352,10 @@ def fit(
.. note:: Weights are per-group for ranking tasks
In ranking task, one weight is assigned to each query group
(not each data point). This is because we only care about the
relative ordering of data points within each group, so it
doesn't make sense to assign weights to individual data points.
In ranking task, one weight is assigned to each query group/id (not each
data point). This is because we only care about the relative ordering of
data points within each group, so it doesn't make sense to assign weights
to individual data points.
base_margin : array_like
Global bias for each instance.
Expand Down

0 comments on commit 0474666

Please sign in to comment.