Open 78Spinoza opened 6 days ago
Thanks @78Spinoza, however these instructions are not how the library is intended to be used. See the unit tests to see how the native GBDTs can be trained, converted to managed objects, and evaluated. I do not recommend using the output of Booster.GetModel, as the ensemble object does not have all the necessary transformations on the output required for binary/multiclass model evaluation.
I checked the unittest. I would like to train the model in Phyton since there are man many visualization and hyperparameter tuning that exist. How can I use a trained model and not Booster.GetModel ? I know that it only works for regression but internally all classification and other are regression for LightGBM but I understand what you say.. Can you please provide some example more simple as I did above?
@78Spinoza I'll have a look at how best to do this and let you know.
Hello there First many thanks for the source code.
You can train your model in phyton or R , whatever and save it in native format. To run it in fully Managed C#: Explanation on how to use the code should be added to the repository Below is what I did to make it work and some small issues that needed to be resolved to get best performance.
Using LightGBM with C# in Fully Managed Code
1. Install the LightGBMNet.Train Package
2. Load a Native LightGBM Model
InvariantCulture
to avoid parsing errors.Booster.FromFile
to load the model:3. Validate the Model
4. Transform the Model to Fully Managed Code
booster.GetModel()
to get the managed model:5. Validate the Managed Model
6. Save and Load the Managed Model
BinaryWriter
andGZipStream
:7. Use the Managed Model in Production
By following these steps, you can effectively use LightGBM with C# in a fully managed environment, ensuring compatibility and performance across different platforms.