Cmdstanr: Only save selected parameters in output

Created on 6 Feb 2020  路  6Comments  路  Source: stan-dev/cmdstanr

Not sure whether this should be a cmdstan or cmdstanr feature request, but it would be very useful if it were possible to only write the parameter estimates for selected parameters to the output (like RStan does with the pars argument).

I'm working with models where I'm only interested in particular post-processed parameters (sign-corrections in latent variable models), but when I use cmdstanr I end up with very large output files, which can be a bit cumbersome.

feature

Most helpful comment

The way how we read the csv data is going to significantly change after https://github.com/stan-dev/cmdstanr/pull/95

The main function is read_sample_csv. Solving this would probably require adding some additional args to this function.

All 6 comments

This can definitely be done in cmdstanr, though that only reduces the size of the samples R object, the output file will stay as big. For now, you can trim the returned samples object manually in R, though doing that through cmdstanr would definitely be nicer.

In Cmdstan, the related issue is https://github.com/stan-dev/cmdstan/issues/553. https://github.com/stan-dev/cmdstan/issues/619 is also somewhat related.

I think that having a way to reduce the size of the R object would aready be a very helpful feature. What function should one look at to implement this?

The way how we read the csv data is going to significantly change after https://github.com/stan-dev/cmdstanr/pull/95

The main function is read_sample_csv. Solving this would probably require adding some additional args to this function.

With the vroom package we can select/drop parameters by name or even use selection helpers (like endswith). Do we want all of them or just the basic select.

Also, any ideas on the argument name for this?

Is this going to be an argument to the model fitting methods ($sample(), $variational(), etc.)?

And I think those helpers would probably be useful.

Was this page helpful?
0 / 5 - 0 ratings