siboehm / lleaves

Compiler for LightGBM gradient-boosted trees, based on LLVM. Speeds up prediction by ≥10x.
https://lleaves.readthedocs.io/en/latest/
MIT License
333 stars 28 forks source link

Best way to integrate into .NET #57

Open onacrame opened 8 months ago

onacrame commented 8 months ago

I'm looking for the best way to integrate a compiled model into .NET code. I'd rather not have to utilise an initial call to Python and rely on the underlying binary. I know there's reference to example in the benchmark section but not sure what adaptations are required to make it work outside of that context

siboehm commented 8 months ago

I'm not familiar with .NET at all sadly. Though the process should be the same as calling any C function, so an approach like this one should work for you. All that's necessary is declaring the function as extern, and passing the path to the binary returned by lleaves to your linker.