microsoft / LightGBM

A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
https://lightgbm.readthedocs.io/en/latest/
MIT License
16.68k stars 3.83k forks source link

C# .Net interface #763

Closed mdabros closed 6 years ago

mdabros commented 7 years ago

Are there any plans for a C# .net interface similar to what is availible for Python and R? For example: https://github.com/Microsoft/LightGBM/blob/master/python-package/lightgbm/sklearn.py

I can see a related issue (https://github.com/Microsoft/LightGBM/issues/74) was closed earlier this year. However, the resulting nuget package only seem to package the command line version of lightGBM.

guolinke commented 7 years ago

It seems c# doesn't have the native Matrices support (like the numpy / pandas in python). As a result, the C# interfaces is not easier to be used, compared with raw cpp version. So we provide the dll in nuget, you can wrap your interface based that dll.

BTW, it seems @ycdoit had done some works for the c# interfaces. @ycdoit can you share some details ?

mdabros commented 7 years ago

I am interested in providing a lightGBM learner/model as a more efficient alternative to my own gradient boost implementation in SharpLearning. With the primary goal of making machine learning more accessible in C#.

My hope was to have a stand-alone C# interface for lightGBM (+ native dll) in a nuget package and then use that package in SharpLearning. If there are currently no plans to develop a C# interface, I would be interested in contributing to get this started. @ycdoit, let me know if you already have something working.

Of course it would be better with an official lightGBM C# release from the Microsoft team. The Microsoft CNTK team has recently announced they are working on full C# support (training/evaluation) for deep learning (https://github.com/Microsoft/CNTK/issues/2194). So something similar from the lightGBM team would be great :-).

JimSEOW commented 7 years ago

@mdabros consolidation! Great job!

stefanks commented 7 years ago

Also very interested in this

fstandhartinger commented 6 years ago

Hi there,

I have created a .NET wrapper for LightGBM (including GPU support) based on the executable version of LightGBM.

If interrested, check it out: LightGbmDotNet

But of course a proper .NET wrapper for LightGBM, maintained by the original team would be even better.

Best regards

Florian

mdabros commented 6 years ago

Hi @fstandhartinger

Thanks for developing a usable C# wrapper for the LightGBM.exe based nuget package. This is definitely a step in the right direction, and I think this will help make LightGBM more accessible to the .net community.

For my specific use-case, including it as a more efficient an alternative to the gradient boost implementation in SharpLearning, I would prefer a solution where the native dll is wrapped directly using pinvoke or similar. As you mention in #74 , this requires considerable effort and probably also requires the help of the LightGBM developers.

I will leave this issue open for the development of a .net wrapper, where the native dll is wrapped directly.

Best regards Mads

fstandhartinger commented 6 years ago

@guolinke: Could you please clarify what you mean with C# missing native Matrices support? I consider writing a C# dll wrapper (or upgrade my current exe based wrapper). Aren't muti dimensional floating point arrays enough for dealing with the LightGBM interface? If not, maybe external libraries like Math.NET can help to fill the gap here. Thanks!

ttustonic commented 6 years ago

Here's another one: https://github.com/ttustonic/LightGBMSharp It is interop library for the original LightGBM dll and has a few classes to mimic Python wrapper. It has no dependencies outside .Net, and only uses MathNet.Numerics for the example.

Cheers, Tom

guolinke commented 6 years ago

refer to https://github.com/dotnet/machinelearning/pull/392 LightGBM will be in ML.Net soon.

StrikerRUS commented 6 years ago

@guolinke Can we close this issue, since LightGBM is in ML.NET now?