hddm-devs / hddm

HDDM is a python module that implements Hierarchical Bayesian parameter estimation of Drift Diffusion Models (via PyMC).
http://ski.clps.brown.edu/hddm_docs/
Other
261 stars 117 forks source link

save fit #83

Open thibault-gajdos opened 2 years ago

thibault-gajdos commented 2 years ago

Hello everyone,

i have a very basic problem: i cannot save my fits.

Configuration: system: mac Big Sur 11.6 Python 3.5.5 hddm 0.8.0

Instruction: m.save("mymodel")

Message: File "/Users/thibault/thib/projects/exercice_ddm/data/Code/hddm_exercice.py", line 57, in

posterior predictive

File "/Users/thibault/opt/anaconda3/envs/py35/lib/python3.5/site-packages/kabuki/hierarchical.py", line 412, in save pickle.dump(self, open(fname, 'w')) TypeError: write() argument must be str, not bytes

Any help on solving this issue or alternative method for saving models and traces would be higly appreciated!

Best thibault

AlexanderFengler commented 2 years ago

You you share a bit more code? At best a reproducible example.

Best, Alex

thibault-gajdos commented 2 years ago

Yes, here it is:

m  =  hddm.HDDM(f_data)
m.sample(20, burn=10,  dbname='traces1', db='pickle')
m.save('fit')

You can replace f_data by any (appropriate) data set. Best, thibault