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

error in the docs for ranking #10142

Closed
fabfabi opened this issue Mar 23, 2024 · 4 comments
Closed

error in the docs for ranking #10142

fabfabi opened this issue Mar 23, 2024 · 4 comments

Comments

@fabfabi
Copy link
Contributor

fabfabi commented Mar 23, 2024

The code snippet in the docs to showcase how to rank produces an error

ranker = xgb.XGBRanker(tree_method="hist",
                       lambdarank_num_pair_per_sample=8, 
                       objective="rank:ndcg", 
                       lambdarank_pair_method="topk")
ranker.fit(X, y, qid=qid)

XGBoostError: [08:38:16] /workspace/src/data/data.cc:532: Check failed: non_dec: qid must be sorted in non-decreasing order along with data.
Stack trace:

to fix it

ranker = xgb.XGBRanker(tree_method="hist",
                       lambdarank_num_pair_per_sample=8, 
                       objective="rank:ndcg", 
                       lambdarank_pair_method="topk")
ranker.fit(X, y, qid=qid[sorted_idx])
@hcho3
Copy link
Collaborator

hcho3 commented Apr 16, 2024

Fixed in #10143

@hcho3 hcho3 closed this as completed Apr 16, 2024
@getsanjeevdubey
Copy link

Screenshot 2024-07-03 at 1 46 24 PM

XGBoostError: [08:16:16] /workspace/src/data/data.cc:539: Check failed: non_dec: qid must be sorted in non-decreasing order along with data.
Stack trace:
[bt] (0) /opt/conda/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x22d7cc) [0x7f62199ee7cc]
[bt] (1) /opt/conda/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x4b4468) [0x7f6219c75468]
[bt] (2) /opt/conda/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(+0x4b4850) [0x7f6219c75850]
[bt] (3) /opt/conda/lib/python3.8/site-packages/xgboost/lib/libxgboost.so(XGDMatrixSetInfoFromInterface+0xb2) [0x7f62198f5b42]
[bt] (4) /opt/conda/lib/python3.8/lib-dynload/../../libffi.so.7(+0x69ed) [0x7f62839279ed]
[bt] (5) /opt/conda/lib/python3.8/lib-dynload/../../libffi.so.7(+0x6077) [0x7f6283927077]
[bt] (6) /opt/conda/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(_ctypes_callproc+0x2f3) [0x7f62827f3983]
[bt] (7) /opt/conda/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(+0x10334) [0x7f62827f4334]
[bt] (8) /opt/conda/bin/python(_PyObject_MakeTpCall+0x31e) [0x564c33129ebe]

@getsanjeevdubey
Copy link

getsanjeevdubey commented Jul 3, 2024

@hcho3 Please help; Copy pasted the documentation code; still some error;
Python 3.8.10

@trivialfis
Copy link
Member

Opened a PR for the fix: #10539 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants