XGBRanker documentation: few clarifications (#8356)

This commit is contained in:
luca-s 2022-10-18 19:54:14 +02:00 committed by GitHub
parent 76f95a6667
commit c47c71e34f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1785,7 +1785,7 @@ class XGBRFRegressor(XGBRegressor):
end_note=""" end_note="""
.. note:: .. note::
The default objectivefor XGBRanker is "rank:pairwise" The default objective for XGBRanker is "rank:pairwise"
.. note:: .. note::
@ -1795,11 +1795,16 @@ class XGBRFRegressor(XGBRegressor):
.. note:: .. note::
Query group information is required for ranking tasks by either using the 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 When fitting the model with the `group` parameter, your data need to be sorted
the model, you need to provide an additional array that contains the size of each by query group first. `group` must be an array that contains the size of each
query group. 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: For example, if your original data look like:
@ -1821,8 +1826,8 @@ class XGBRFRegressor(XGBRegressor):
| 2 | 1 | x_7 | | 2 | 1 | x_7 |
+-------+-----------+---------------+ +-------+-----------+---------------+
then your group array should be ``[3, 4]``. Sometimes using query id (`qid`) then `fit` method can be called with either `group` array as ``[3, 4]``
instead of group can be more convenient. or with `qid` as ``[`1, 1, 1, 2, 2, 2, 2]``, that is the qid column.
""", """,
) )
class XGBRanker(XGBModel, XGBRankerMixIn): class XGBRanker(XGBModel, XGBRankerMixIn):