From 83191f0839ad4b729b61fee0e12e7349ade84a62 Mon Sep 17 00:00:00 2001 From: Thomas Lynn <32374143+lynntf@users.noreply.github.com> Date: Sat, 14 Oct 2023 10:38:58 +0200 Subject: [PATCH] Update learning_to_rank.rst; Correct qid sort in snippet (#9673) --- doc/tutorials/learning_to_rank.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/tutorials/learning_to_rank.rst b/doc/tutorials/learning_to_rank.rst index c562dc2df..015f736e0 100644 --- a/doc/tutorials/learning_to_rank.rst +++ b/doc/tutorials/learning_to_rank.rst @@ -58,6 +58,7 @@ Notice that the samples are sorted based on their query index in a non-decreasin sorted_idx = np.argsort(qid) X = X[sorted_idx, :] y = y[sorted_idx] + qid = qid[sorted_idx] The simplest way to train a ranking model is by using the scikit-learn estimator interface. Continuing the previous snippet, we can train a simple ranking model without tuning: