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

XGBRanker documentation: few clarifications #8356

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Changes from all commits
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
17 changes: 11 additions & 6 deletions python-package/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1785,7 +1785,7 @@ def fit(
end_note="""
.. note::

The default objectivefor XGBRanker is "rank:pairwise"
The default objective for XGBRanker is "rank:pairwise"

.. note::

Expand All @@ -1795,11 +1795,16 @@ def fit(
.. note::

Query group information is required for ranking tasks by either using the
`group` parameter or `qid` parameter in `fit` method.
`group` parameter or `qid` parameter in `fit` method. This information is
not required in 'predict' method and multiple groups can be predicted on
a single call to `predict`.

Before fitting the model, your data need to be sorted by query group. When fitting
the model, you need to provide an additional array that contains the size of each
When fitting the model with the `group` parameter, your data need to be sorted
by query group first. `group` must be an array that contains the size of each
query group.
When fitting the model with the `qid` parameter, your data does not need
sorting. `qid` must be an array that contains the group of each training
sample.

For example, if your original data look like:

Expand All @@ -1821,8 +1826,8 @@ def fit(
| 2 | 1 | x_7 |
+-------+-----------+---------------+

then your group array should be ``[3, 4]``. Sometimes using query id (`qid`)
instead of group can be more convenient.
then `fit` method can be called with either `group` array as ``[3, 4]``
or with `qid` as ``[`1, 1, 1, 2, 2, 2, 2]``, that is the qid column.
""",
)
class XGBRanker(XGBModel, XGBRankerMixIn):
Expand Down