fabsig / GPBoost

Combining tree-boosting with Gaussian process and mixed effects models
Other
574 stars 46 forks source link

Support needed to pickle the GPBoost model #44

Closed RevatiKrishna closed 2 years ago

RevatiKrishna commented 2 years ago

Hi I have used GPBoost library for my project which requires mixed effects features. After the model building using training data, I am trying to save the model using pickle and joblib. I am encountering the below error.

ValueError: ctypes objects containing pointers cannot be pickled

Seems like there are pointers used in the library. Could you please help me with a way where I can save and use the trained model of GPBoost?

fabsig commented 2 years ago

Thank you for using GPBoost.

GPBoost models can be saved using internal functions as illustrated here: https://github.com/fabsig/GPBoost/blob/be14ab3479d9402bac4f1135f3c06aea2d87d394/examples/python-guide/GPBoost_algorithm.py#L155

Using pickle does not work because of the pointer issue which is related to the fact that most of the data is not kept in Python but in the C++ part.

I hopes this helps.