Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling model with custom objective #73

Open
Thomzoy opened this issue Feb 29, 2024 · 3 comments
Open

Compiling model with custom objective #73

Thomzoy opened this issue Feb 29, 2024 · 3 comments

Comments

@Thomzoy
Copy link

Thomzoy commented Feb 29, 2024

I've saved a LightGBM model trained using a custom objective. Is it possible to compile it through lleaves ?

Currently, I'm getting a RuntimeError: Missing non-nullable keys {'objective'} when running:

llvm_model = lleaves.Model(model_file="../scripts/my_model.json")
llvm_model.compile()

Thanks !

@yyylllaaafff
Copy link

Hi, @Thomzoy , I came up with the same issue. Did you fix it?

@siboehm
Copy link
Owner

siboehm commented Aug 12, 2024

Can either of you send me their trained tree? Or a model.txt for a model that was trained with a custom objective? I've never thought about this before, so it won't work out of the box.

One solution would be to compile without any objective function (by editing the model.txt to remove it), and then just implementing the objective function yourself in Python / C / numba based on the raw outputs of the tree.

@ogencoglu
Copy link

+1 for this feature. Any way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants