I would like to save the model’s parameter and reuse it.
Find out I could’t save the model during the iteration(only if I change the C++ code: Get intermediate results in pystan)
So I would like to save the model in other ways.Use “Pickle library” to save and load data after finiishing iteration.(Save fit model in pystan)
But I have no idea how to reuse this data to train again.
Any response could help,thanks!
#Load file
with open(“test_1.pkl”, “rb”) as f:
data_dict = pickle.load(f)
sm = data_dict[‘sm’]
fit = data_dict[‘fit’]
############# how to reuse the model here? ################
sm = pystan.StanModel(model_code=schools_code)
fit = sm.sampling(data=fit.data, iter=1500, chains=3)