Generate CSV files from CmdStanFit
cmdstan_diagnose() throws error "No valid input files, exiting" after call to save_object() For example,
library(cmdstanr)
fit <- cmdstanr_example("logistic")
fit$save_object("fit.rds")
# quit R, restart R
library(cmdstanr)
fit <- readRDS("fit.rds")
fit$cmdstan_diagnose()
I would expect the saved fitted object to contain and print diagnostic information. Per help file for save_object:
This method is a wrapper around base::saveRDS() that ensures that all posterior draws and diagnostics are saved when saving a fitted model object.
cmdstanr 0.1.1 CmdStan 2.24.1 macOS Catalina
Yeah good catch. I think this is related to the other issue you found (https://github.com/stan-dev/cmdstanr/issues/279) because the problem is that $cmdstan_diagnose() needs the CSV files. The $summary() method also has the diagnostics and doesn't require the CSV files, but it would be nice if $cmdstan_diagnose() also worked in this case. To do that we need to do something like rewriting the CSV files, like you mentioned in https://github.com/stan-dev/cmdstanr/issues/279.
Doing a bit of cleaning of the old issues.
Renamed the issue to more precisely show what would be the resolution here which is creating CSV files from fit objects. This would also fix https://github.com/stan-dev/cmdstanr/issues/279
Going to close this (cleaning up some old issues). At this point I don't think it's worth adding code to the package to reconstitute the CSV files in such a format that the CmdStan diagnose utility can work with them if the user no longer has them. The user can save the CSV files by specifying output_dir or the user can use fit$diagnostic_summary() without needing to keep the CSVs, which didn't exist at the time this issue was opened.