XBCF icon indicating copy to clipboard operation
XBCF copied to clipboard

Add ability to save/load trained model

Open awooddoughty opened this issue 2 years ago • 1 comments

Greetings,

First, thank you for all your work on this, it's really fantastic! Second, I don't think it's currently possible (though would love to be wrong) to save/load a trained model. This would be really useful for production workflows where we want to have separate processes for training and prediction.

As far as I can tell just trying to pickle the class fails because pickle can't handle C++ and there are no functions to extract a serializable model state. I think XBart does this by implementing a to_json function (example), but seems like all of the logic was commented out in XBCF. I assume there is some work to get that working (and it looks like maybe XBCF is getting merged into XBart?), but just curious if this is something that could be added to the roadmap.

Thanks!

awooddoughty avatar Mar 20 '23 22:03 awooddoughty

Hi Alex, thanks for the interest in the package!

You're right about the ability to save models disabled for the version of XBCF in this repo. You are also correct that we indeed moved XBCF to the original XBART repo, and the current re-implementation allows to save model, but it's only available for R right now (a test comparing two versions of XBCF available here).

We intend to re-implement XBCF in python using pybind, however we currently have no timeline for when that will be worked on. All future work will be going on in XBART repo so I would recommend to follow that repository.

I will keep this issue open for now and will close it once the updated version of the python package is available and will link it here.

socket778 avatar Mar 22 '23 22:03 socket778

Hi Alex, I'm closing this issue as XBCF has become part of the StochasticTree package (available in both Python and R), please visit https://github.com/StochasticTree/stochtree-cpp for the most recent version of the package in case it's still relevant.

socket778 avatar Jun 25 '24 22:06 socket778