Hi!,
I have a program that fits a model to data. At the end of the program I export a file that contains list of the best parameters gathered by the Sow and Reap commands. What I would like to do, is have the program write out the parameters to a file while the program is actually running. This way if anything were to happen to the program while it was running, I would be able to start again using the written parameters. Instead of having to start all the way from scratch. I’ve tried using OpenWrite for this, but have failed miserably. Can someone help with this? I’ll attach a snippet of code that contains the portion that Sows the parameters, if anything else is needed please let me know.
Thanks,
If[u[[i]] < v[[i]],(*If u<v always accept that parameter set, else accept with probability u<v*)
ka[[i + 1]] = ka[[i]];
kb[[i + 1]] = kb[[i]];
Sow[{True, decayscore[[i]], v[[i]], ka[[i]], kb[[i]], i}],(* These quantities are written to ParamSets *)
ka[[i]] = ka[[i - 1]];
kb[[i]] = kb[[i - 1]];
]