[ISSUE-10463] Add missing import in learning-to-rank tutorial (#10464)

* added 'sorted()' to qid, and added pandas import

* Update learning_to_rank.rst

---------

Co-authored-by: Philip Hyunsu Cho <chohyu01@cs.washington.edu>
This commit is contained in:
jpizagno 2024-06-22 00:52:34 +02:00 committed by GitHub
parent 61ac8eec8a
commit 124bc57a6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,6 +71,7 @@ Please note that, as of writing, there's no learning-to-rank interface in scikit
.. code-block:: python
import pandas as pd
df = pd.DataFrame(X, columns=[str(i) for i in range(X.shape[1])])
df["qid"] = qid[sorted_idx]
ranker.fit(df, y) # No need to pass qid as a separate argument