-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
lightgbm.basic.LightGBMError: Label 72 is not less than the number of label mappings (31) #4808
Comments
Hi @sofiavlachou28 , thanks very much for using LightGBM! I'd be happy to help you, but we need a little more information.
|
@sofiavlachou28 please refer to parameter |
@jameslamb I use the Version 3.3.1. Also, I uploaded my csv dataset for more understaning. Thanks for your time!! :) |
@jameslamb Also, I saw that lightgbm requires:
|
@sofiavlachou28 Thanks for using LightGBM! Ranking objectives in LightGBM use |
Okay. I will try it with this parameter. I hope it works..! |
Thanks for providing the dataset @sofiavlachou28 . Looking at the data, I have some observations and a suggestion. The If you set It seems you're using column One other suggestion...I noticed the full dataset has only 91 rows, even before holding out some data for validation. sample code (click me)import lightgbm as lgb
import pandas as pd
data_url = "https://github.com/microsoft/LightGBM/files/7569237/Posts.csv"
feature_names = ["Frequency","Comments", "Likes", "Nwords"]
df = pd.read_csv(
filepath_or_buffer=data_url,
delimiter=";",
encoding="utf-8",
names=feature_names,
delim_whitespace=False,
header=0
)
df.shape LightGBM has a few parameters to limit model complexity, whose defaults are set to work well with medium-sized datasets (1000s of observations). If you want LightGBM to learn from 92 observations, consider setting a very small value (like 2) for parameter |
Τhank you so much for your reply! it is very helpful! I will look at your observations more carefully and I will test my data again, as you suggest. I hope it works. If not, I will open the topic again! Have a good day! |
This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM! |
Hello to everyone! After some research and a few hours of hacking, my code is still not working. I do not find anywhere information on how to set the _My task is to find the most popular product/s each time based on likes, comments, or frequency and so on, and I want to do this with Ranking. Here is my code! I am new to Python ! Can anyone help me??
And here is the bug:
Thank you in advance!! |
I had the same problem with label mappings when I tried to use LGBMRanker with Optuna. I did them work well together by following this example. As suggested, I set the
I hope it can also help you! Best, |
@thaisalmeida Thanks for your reply! I don't understand how to set the label_gain in my code... still raises an error: Can share your code ? or if you don't want, can you help me to set this parameter in my code below? Thank you in advance :) !! Here is my New code:
|
@sofiavlachou28 Thanks for your interest in LightGBM! I wrote up a learning-to-rank example tonight to hopefully answer this and other issues you've opened regarding
|
This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM! |
@jameslamb What should we do if there is no constraint on the importance or equal importance? Also, let's say there are variable length of items in each group. what should be the length of any help is appreciated, thanks |
@sathyarr I think you are correct about label_gain=[1, 1, 1, 1, 1] represents equal importance of all items we are ranking. About your second topic i think label_gain refers to number of ratings (label mapings), not the number of items being rated, based on Error raised in this issue: Label x is not less than the number of label mappings (y) I think the misunderstanding comes from this:
and it is more correct to say: correctly labeling items as first or second highest score is twice as important as correctly labeling items as second or third highest score I would be very grateful if @jameslamb or someone with greater understanding of model than me can confirm or deny this, thanks |
Thanks for the comment @lukav27 makes sense, let's wait for any contributor comments! 🙂 |
Re-opening this since there are unanswered questions, but I personally would need to do some research before providing an answer. |
Hello to everyone!!
I am new to Python and Iam getting this error when running LightGBM about a Ranking problem:
lightgbm.basic.LightGBMError: Label 72 is not less than the number of label mappings (31)
I tried to search for this error, could not find much useful resources.
I cant guess where the error occurs.
Μy dataset consists of 4 columns: ["Frequency","Comments", "Likes", "Nwords"] as seen below.
Can anyone help me??
Thank you in advance !!
Sofia
The text was updated successfully, but these errors were encountered: