rca22 / LightGBM.Net

.Net wrapper around the LightGBM library
MIT License
15 stars 5 forks source link

To run it in fully Managed C#: Explanation on how to use the code. This information should be added to the repository #7

Open 78Spinoza opened 6 days ago

78Spinoza commented 6 days ago

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

3. Validate the Model

4. Transform the Model to Fully Managed Code

5. Validate the Managed Model

6. Save and Load the Managed Model

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.

mjmckp commented 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.

78Spinoza commented 1 day ago

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?

mjmckp commented 11 hours ago

@78Spinoza I'll have a look at how best to do this and let you know.