Lightgbm: [R-package] Implementing python's lightgbm module using reticulate

Created on 18 Dec 2019  路  7Comments  路  Source: microsoft/LightGBM

Hello,

I have experimented a little during the last weeks and maybe this is of interest for someone:

I was able to implement the lightgbm python module in the R package lightgbm.py.

It works so far and I have added vignettes for binary classification and multiclass classification examples as well as a regression task.

Using reticulate, the R package implementation of the python module is straight forward. The package itself is easy to install and can also be integrated into other R packages as a dependency (such as the mlr3learners.lgbpy R package). Currently, there are no CRAN errors/warnings/notes, however, it has not yet been checked extensively on multiple platforms.

Currently, only the python module's train function is implemented, however, if this approach is of interest for someone, the code could be extended.

r-package

Most helpful comment

^ I've added #2670 which references this project. Thanks @kapsner !

All 7 comments

@kapsner Thank you very much for sharing your experiments!

Indeed, unfortunately, there is a huge gap between functionality of Python and R packages right now. And I think a real solution will be synchronizing development of packages. Usage of reticulate I guess significantly hurts a performance and has other (latent) drawbacks related to proxying.

But for now, those who really want to write R code and have access to functionality presented in the Python-package, can try that approach.

cc @jameslamb @Laurae2

@StrikerRUS Thanks for your answer.

I agree, that using the python-module via reticulate should not be the preferred way to bring lightgbm to R. It could be some kind of workaround to use lightgbm in other R packages (such as the mlr3learners) until the official R package is on CRAN and can then easily be integrated into other R packages.

@kapsner thanks for sharing this! Agree with @StrikerRUS on both points...we don't recommend the reticulate approach for performance and maintainability reasons, but also development on the R package is behind that in Python so for some features I think this does fill a need.

@StrikerRUS I'd like to add it to https://github.com/microsoft/LightGBM#external-unofficial-repositories, any objection?

@jameslamb As that section is not designed to provide any detailed comments, maybe it's better to place the link somewhere into https://github.com/microsoft/LightGBM/blob/master/R-package/README.md? And I don't think that the face page of the project is a good place to provide references to not recommended packages. It will allow to not mislead newcomers (they should try native R-package first) and give an opportunity to choose for those who have already dug deeper into the repository and struggling during installation/usage for any reasong.

@jameslamb ...maybe it's better to place the link somewhere into https://github.com/microsoft/LightGBM/blob/master/R-package/README.md...

Ok yes, I agree! Will make a PR soon adding the recommendation inside the R docs.

^ I've added #2670 which references this project. Thanks @kapsner !

Thank you very much @jameslamb

Was this page helpful?
0 / 5 - 0 ratings