'Is there a way to implement a LightGBM model into R without access to the LightGBM package?
For my use case I do not have the luxury of having access to the R version of the LightGBM package. I'd like to implement a trained model into a platform that can use R but does NOT have access to the LightGBM package.
For example, something analogous to this would be handy: https://cran.r-project.org/web/packages/gbm2sas/gbm2sas.pdf
Which one can basically creates a brute-force "if-else-then" script logic to aggregate up the marginal predictions into SAS code. Is there something like a "lightgbm2R" package out there that creates an "R script" for the "if-then-else" logic?
I've also looked into outputting the model into a JSON and importing it into R that way, too, but there doesn't seem to be a way to pass predictions into the model without access to LightGBM's predict function using the R's lightgbm package.
I do have access to R's gbm package, however. Is there a way this package could possibly import a LightGBM trained model file? The platform also has access to Python (but again no access to the LightGBM package). I know you can output the model file to a dataframe (i.e. "trees_to_dataframe()", but I have no idea how to pass the model features to this dataframe to get a prediction. If there's an example out there that shows how to do this (again, without leveraging the LightGBM package) that would also work.
I REALLY do not want to manually code in "if-then-else" logic for the tree. I was hoping there would be some sort of "standard" for exporting/importing serialized model objects across platforms (such as how JSON is a standard that is recognized across many platforms), but I can't seem to find such a thing for tree models.
In summary, the question is this: Is there a way to get a prediction from a LightGBM model file in either R or Python WITHOUT access to the LightGBM package that does not involve manually coding in the "if-then-else" tree logic?
Thank you for your time, SYL
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
