Best way to save and load operated data by PyMC3


#1

Hi.
I just have a simple question but requires me to do lots of trial and errors.
Until now, I have not thought about the save and load of data after analyses using PyMC3.
If you have ever used MATLAB, then you would know save function saves all the variables in the workspace as a file has mat extenstion.
In Python environment, especially when I do some time consuming things using PyMC3, so that I need to save works done and continue after, what is the best way to save and load variables or workspace?
I quite doubt that the properties of PyMC3 variables or functions can be used seamlessly like MATLAB when I load working space.
That is, run functions in PyMC3 such as traceplot, plot_posterior and so on right after load saved variables.
Would you please give me some valuable advice regarding this matter?
Thank you in advance.


#2

Something like pickling is the closest you can try. But you cannot do something like in Matlab still, as eg you always need to reload modules in python.


#3

Thank you very much @junpenglao.
I take a look at what the pickle is and it seems like I have to specify PyMC3 related objects and variables manually.
To be able to continue the work, I will have to load the saved PyMC3 objects using pickle and import used libraries.
Is my understanding right?
If so, this is not as convenient as MATLAB though, as least I can continue my work without running MCMCs again.
I will give it a try.