You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update Microsoft.ML.LightGbm to use version 3.0 + of LightGbm. #5447
I get this error: System.InvalidOperationException: 'LightGBM Error, code is -1, error message is 'Unknown importance type: only support split=0 and gain=1'.'
This error can be reproduced by an example. I just used the example in docs.microsoft.com and able to reproduce it.
I talked to the LightGBM team and they mentioned this issue exists in .Net code and not theirs. This is the third time this issue has been reported (#5431 and #5382) and each time it has been closed without any resolution.
As I said in issue #5431, I copied the code you've attached in your repro, put it in a new console project, installed the Microsoft.ML (1.5.2) and Microsoft.ML.LightGbm (1.5.2) NuGet packages, and tried to reproduce your issue, but your code passed successfully. I also attached that exact same project in my comment here.
I also tried the exact same project you've attached, and saw that I get exact same exception of Unknown importance type: only support split=0 and gain=1.. However, I do not get this exception without the LightGBM 3.0.0 package.
Did you try to run this repro project I attached in my last comment and see if this passed on your computer? It works on mine. If it also runs on yours, the problem must be in the LightGBM 3.0.0 project you've added. This is indeed the case, as I have even found the exact source of this error, in LightGBM's code here. This means that this issue is stemming from this LightGBM 3.0.0 package, and not from ML.NET.
If there is anything else I can offer my assistance with, please let me know. Thanks.
Thank you so much for getting back to this conversion.
Yes, as you said before, everything works if I use LightGBM 2.3.1 and I am using it in my project right now and do not have any problem. But the new version has a lot of good improvements which is going to be a great improvement in my project.
You are right about the place that it returns the exception as well but I read the code found out they introduce some new parameters that do not accept the default value anymore. I believe the new parameter is saved_feature_importance_type but I could not find a way to pass this value.
Thank you for your kind summary on the changes from LightGBM v2.3.1 to v3.0. For ML.NET to support LightGBM v3.0, we will need to make significant changes to Microsoft.ML.LightGBM. I have marked this issue as a feature request for the time being. In the meantime, the LightGBM version that ML.NET supports is v2.3.1.
If this is not planned for near future, would be nice to release new version of Microsoft.ML.LightGBM with constrain for upper bound of LightGBM (>= 2.2.3 && < 3.0.0)
changed the title [-]System.InvalidOperationException: 'LightGBM Error, code is -1 (LightGbm 3.0.0)[/-][+]Update Microsoft.ML.LightGbm to use version 3.0 + of LightGbm.[/+]on Jun 23, 2021
Activity
mstfbl commentedon Oct 22, 2020
Hi @gharibkhani ,
As I said in issue #5431, I copied the code you've attached in your repro, put it in a new console project, installed the
Microsoft.ML (1.5.2)andMicrosoft.ML.LightGbm (1.5.2)NuGet packages, and tried to reproduce your issue, but your code passed successfully. I also attached that exact same project in my comment here.I also tried the exact same project you've attached, and saw that I get exact same exception of
Unknown importance type: only support split=0 and gain=1.. However, I do not get this exception without theLightGBM 3.0.0package.Did you try to run this repro project I attached in my last comment and see if this passed on your computer? It works on mine. If it also runs on yours, the problem must be in the
LightGBM 3.0.0project you've added. This is indeed the case, as I have even found the exact source of this error, in LightGBM's code here. This means that this issue is stemming from thisLightGBM 3.0.0package, and not from ML.NET.If there is anything else I can offer my assistance with, please let me know. Thanks.
gharibkhani commentedon Oct 22, 2020
@mstfbl
Thank you so much for getting back to this conversion.
Yes, as you said before, everything works if I use LightGBM 2.3.1 and I am using it in my project right now and do not have any problem. But the new version has a lot of good improvements which is going to be a great improvement in my project.
You are right about the place that it returns the exception as well but I read the code found out they introduce some new parameters that do not accept the default value anymore. I believe the new parameter is saved_feature_importance_type but I could not find a way to pass this value.
gharibkhani commentedon Oct 22, 2020
@mstfbl
I looked at the code to see where do we need the change and found this:
LGBM_BoosterSaveModelToString has 7 parameters in v3.0 but in our side (here) it has 6 parameters
At the side research, I checked the other APIs calls to see if there is any discrepancy and found these:
Hopefully, these can help with your research.
mstfbl commentedon Oct 28, 2020
Hey @gharibkhani ,
Thank you for your kind summary on the changes from LightGBM v2.3.1 to v3.0. For ML.NET to support LightGBM v3.0, we will need to make significant changes to
Microsoft.ML.LightGBM. I have marked this issue as a feature request for the time being. In the meantime, the LightGBM version that ML.NET supports is v2.3.1.sergey-tihon commentedon Dec 29, 2020
If this is not planned for near future, would be nice to release new version of
Microsoft.ML.LightGBMwith constrain for upper bound ofLightGBM (>= 2.2.3 && < 3.0.0)[-]System.InvalidOperationException: 'LightGBM Error, code is -1 (LightGbm 3.0.0)[/-][+]Update Microsoft.ML.LightGbm to use version 3.0 + of LightGbm.[/+]ericstj commentedon Dec 5, 2023
@michaelgsharp can we close this one now that #6880 is in?
luisquintanilla commentedon Dec 7, 2023
released in Ml.NET 3.0