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

Export Model #78

Closed
Eyal-Elbaz opened this issue Oct 30, 2020 · 4 comments · Fixed by #79
Closed

Export Model #78

Eyal-Elbaz opened this issue Oct 30, 2020 · 4 comments · Fixed by #79
Labels
bug Something isn't working

Comments

@Eyal-Elbaz
Copy link

Hi there,
I have a XGBoost model like this:

var trainer = new XGBoostRegressionTrainer(XGBoostRegressionTrainer.RegressionType.LINEAR, 50,50,true);
var model = trainer.train(trainData);

and I want to save him and load him like this but I didn't manage

@Eyal-Elbaz Eyal-Elbaz added the bug Something isn't working label Oct 30, 2020
@Craigacp
Copy link
Member

Tribuo doesn't expose the XGBoost4J Booster class that you could use to save it following the XGBoost4J instructions. You can serialise Tribuo models directly via an ObjectOutputStream and deserialise them using an ObjectInputStream. Unfortunately in v4.0.1 regression model serialization is broken (see #67), but that's fixed in the main branch and v4.0.2 which is coming very soon.

If you want to train the model in Tribuo and load it in another system then we're considering ONNX export support. We can look at exposing the internal Boosters too.

@Eyal-Elbaz
Copy link
Author

how can I export using ONNX?

@Craigacp
Copy link
Member

Craigacp commented Nov 1, 2020

You can't yet. The onnx model converters are all written in python, so we need to figure out how to build equivalent operations in Java using the onnx c API.

However PR #79 does expose the internal Booster objects so you can save those using the XGBoost4J API.

@Eyal-Elbaz
Copy link
Author

Ok, thanks, I will try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants