A .NET wrapper for the LightGBM machine learning library, including GPU support.
LightGBM is one of the leading Gradient Boosting solutions, provided open source by Microsoft.
using(var lightGbm = new LightGbm())
{
lightGbm.Train(trainingData); //optionally pass parameters
var predictions = lightGbm.Predict(predictionData); //returns an array of predictions
lightGbm.SaveModel("somefile.txt"); //for later reuse of the trained machine learning model without retraining
}
Where both trainingData
and predictionData
are of type IEnumerable<IEnumerable<double>>
representing rows of double values.
First column in trainingData
is the label column (the value that you want to predict).
Omit this column in predictionData
.
MIT
- You might need to install the Visual Studio 2015 C++ Redistributable on the machine you want to run this on.
- Please be aware this wrapper uses files to transfer data to LightGBM and may write a considerable amount of data on your disk
- Don't forget to dispose the LightGbm instance after use to make sure the created files are cleaned up
- To use GPU acceleration (only provided for NVIDIA cards) pass
true
to the constructor of LightGbm class. If it crashes you might need to install the OpenCL implementation from NVIDIA (CUDA). - Works only on Windows, 64 Bit, .NET Framework 4.6.1 or higher (should also work with lower .NET Framework versions if compiled with it)
Not tested myself so far:
- XGBoost wrapper in SharpLearning => highly recommending you to check this out
- LightGBMSharp => looks a bit basic so far
Both libraries work using in process / in memory data transfer to / from the native machine learning libraries, which should lead to superior performance compared to LightGbmDotNet