Skip to content

Commit c47c71e

Browse files
authored
XGBRanker documentation: few clarifications (dmlc#8356)
1 parent 76f95a6 commit c47c71e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

python-package/xgboost/sklearn.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ def fit(
17851785
end_note="""
17861786
.. note::
17871787
1788-
The default objectivefor XGBRanker is "rank:pairwise"
1788+
The default objective for XGBRanker is "rank:pairwise"
17891789
17901790
.. note::
17911791
@@ -1795,11 +1795,16 @@ def fit(
17951795
.. note::
17961796
17971797
Query group information is required for ranking tasks by either using the
1798-
`group` parameter or `qid` parameter in `fit` method.
1798+
`group` parameter or `qid` parameter in `fit` method. This information is
1799+
not required in 'predict' method and multiple groups can be predicted on
1800+
a single call to `predict`.
17991801
1800-
Before fitting the model, your data need to be sorted by query group. When fitting
1801-
the model, you need to provide an additional array that contains the size of each
1802+
When fitting the model with the `group` parameter, your data need to be sorted
1803+
by query group first. `group` must be an array that contains the size of each
18021804
query group.
1805+
When fitting the model with the `qid` parameter, your data does not need
1806+
sorting. `qid` must be an array that contains the group of each training
1807+
sample.
18031808
18041809
For example, if your original data look like:
18051810
@@ -1821,8 +1826,8 @@ def fit(
18211826
| 2 | 1 | x_7 |
18221827
+-------+-----------+---------------+
18231828
1824-
then your group array should be ``[3, 4]``. Sometimes using query id (`qid`)
1825-
instead of group can be more convenient.
1829+
then `fit` method can be called with either `group` array as ``[3, 4]``
1830+
or with `qid` as ``[`1, 1, 1, 2, 2, 2, 2]``, that is the qid column.
18261831
""",
18271832
)
18281833
class XGBRanker(XGBModel, XGBRankerMixIn):

0 commit comments

Comments
 (0)