I run a proprietary ODE chemical reaction network. So my output are multiresponses.
Each draw of my generated quantities have 3 arrays of [5k, 4, 4]
.csv files are huge to a point where I run into memory issues when importing them back (each chain 5GB).
Anyone who tried to fork/branch the stan compiler or extend it such that a binary save would be possible? Reason: double precision encoding instead of flat character strings should save on filesize considerably.
I am barely at script kiddie level when it comes to C++ coding.
The nutpie sampler from PyMC supports Stan models and can save the samples to a couple binary formats. There is also a community developed R wrapper, though I’m not sure if it supports all the same options
This isn’t an ideal solution, but you can use data.table::fread() to selectively pull columns from the csvs (with threading), then save them as a binary format. I used this to split multi-GB csvs into one qs file per parameter group. I’ve found it vastly increased the speed of my post-fit analysis. The downside, of course, is that you’ll need to run your own diagnostics and any code that depends on having valid stanfit objects will need to be adjusted.