SurPyval icon indicating copy to clipboard operation
SurPyval copied to clipboard

Save/Load surpyval

Open lisandrojim opened this issue 1 year ago • 7 comments

Hello,

I am trying to save locally a survival model. But I get an error. Below an example:

import surpyval as surv
import numpy as np
import pickle
from joblib import dump

np.random.seed(10)
x = surv.Weibull.random(50, 30., 9.)
model = surv.Weibull.fit(x)
results = {'model':model}

# Using pickle
pickle.dump({'model':model},open('surpyval_model',"wb"))
# Using dump
dump(model,'surpyval_model.joblib')

None of the methods work. These are the errors I get:

Using pickle AttributeError: Can't pickle local object 'bounds_convert.<locals>.transform' Using dump PicklingError: Can't pickle <function bounds_convert.<locals>.transform at 0x7f98c4178a60>: it's not found as surpyval.parametric.fitters.bounds_convert.<locals>.transform

Any advice?

lisandrojim avatar Sep 20 '22 10:09 lisandrojim