Skip to content

Commit cd1d108

Browse files
authored
[doc] Fix learning to rank tutorial. [skip ci] (dmlc#10539)
1 parent 6243e7c commit cd1d108

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/tutorials/learning_to_rank.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ Please note that, as of writing, there's no learning-to-rank interface in scikit
7272
.. code-block:: python
7373
7474
import pandas as pd
75+
76+
# `X`, `qid`, and `y` are from the previous snippet, they are all sorted by the `sorted_idx`.
7577
df = pd.DataFrame(X, columns=[str(i) for i in range(X.shape[1])])
76-
df["qid"] = qid[sorted_idx]
78+
df["qid"] = qid
79+
7780
ranker.fit(df, y) # No need to pass qid as a separate argument
7881
7982
from sklearn.model_selection import StratifiedGroupKFold, cross_val_score

0 commit comments

Comments
 (0)