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

Question: proper way to save/load XGBSEStackedWeibull model #47

Open
yerachoi opened this issue Dec 21, 2021 · 1 comment
Open

Question: proper way to save/load XGBSEStackedWeibull model #47

yerachoi opened this issue Dec 21, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@yerachoi
Copy link

Hi. First of all, thank you for developing and sharing XGBSE, which has been of great help for me.
I'd like to know how to properly save/load all the key components of a trained XGBSEStackedWeibull model.
I have tried out several saving methods but have failed thus far to retrieve the exact same results from the loaded model.

@GabrielGimenez
Copy link
Contributor

GabrielGimenez commented Jan 5, 2022

We usually use joblib dump and load to save and load models.
It's important to fix xgboost, sklearn and lifelines versions when loading, to avoid some difference in the underlying libraries.

so it should be something like

from joblib import dump, load
from xgbse import XGBSEStackedWeibull

...

model = XGBSEStackedWeibull()
model.fit(x_train, y_train)
dump(model, model_path)

...

model = load(model_path)
predictions = model.predict(x_valid)

I'll add a save and load example to the documentation

@GabrielGimenez GabrielGimenez added the documentation Improvements or additions to documentation label Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants