Skip to content

Adds the ability to load a pre-trained LightGBM file and import it into ML.Net. #6569

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

Merged
merged 6 commits into from
May 16, 2023

Conversation

michaelgsharp
Copy link
Member

Fixes #6296.

Adds the ability to load a pre-trained LightGBM file and import it into ML.Net.

@ghost ghost assigned michaelgsharp Feb 13, 2023
/// <param name="catalog">The <see cref="RegressionCatalog"/>.</param>
/// <param name="lightGbmModel"> A pre-trained <see cref="System.IO.Stream"/> of a LightGBM model file inferencing</param>
/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
public static LightGbmRegressionTrainer LightGbm(this RegressionCatalog.RegressionTrainers catalog,
Copy link
Contributor

@LittleLittleCloud LittleLittleCloud May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happen if loading an LightGBM model newer than 2.3.1, maybe we can add test for that scenario?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So at least "officially" we aren't going to support it. But @torronen said he would test it and let us know since the model format itself should be the same. Since we are going to be updating to the latest version though this year this is only a temporary situation.

@codecov
Copy link

codecov bot commented May 15, 2023

Codecov Report

Merging #6569 (c38594c) into main (f848603) will increase coverage by 0.38%.
The diff coverage is 64.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6569      +/-   ##
==========================================
+ Coverage   68.39%   68.78%   +0.38%     
==========================================
  Files        1174     1215      +41     
  Lines      248045   251729    +3684     
  Branches    25909    26250     +341     
==========================================
+ Hits       169649   173140    +3491     
- Misses      71627    71774     +147     
- Partials     6769     6815      +46     
Flag Coverage Δ
Debug 68.78% <64.62%> (+0.38%) ⬆️
production 63.29% <62.31%> (+0.53%) ⬆️
test 88.88% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Microsoft.ML.LightGbm/LightGbmBinaryTrainer.cs 87.40% <12.50%> (-7.34%) ⬇️
...Microsoft.ML.LightGbm/LightGbmRegressionTrainer.cs 78.57% <12.50%> (-7.29%) ⬇️
...rc/Microsoft.ML.LightGbm/LightGbmRankingTrainer.cs 83.09% <20.00%> (-6.05%) ⬇️
src/Microsoft.ML.LightGbm/LightGbmCatalog.cs 75.40% <25.00%> (-24.60%) ⬇️
...Microsoft.ML.LightGbm/LightGbmMulticlassTrainer.cs 91.28% <87.50%> (+1.28%) ⬆️
src/Microsoft.ML.LightGbm/LightGbmTrainerBase.cs 81.09% <89.39%> (+1.31%) ⬆️
...rc/Microsoft.ML.LightGbm/WrappedLightGbmBooster.cs 90.47% <95.83%> (+0.47%) ⬆️
...osoft.ML.Tests/TrainerEstimators/TreeEstimators.cs 97.84% <100.00%> (+0.03%) ⬆️

... and 131 files with indirect coverage changes

@michaelgsharp
Copy link
Member Author

Merging, known issue #6686.

@michaelgsharp michaelgsharp merged commit f93ab25 into dotnet:main May 16, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 15, 2023
@michaelgsharp michaelgsharp deleted the lightgbm-file branch November 18, 2024 20:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support loading lightgbm model from a file
2 participants