During-sampling diagnostics (feature request & design discussion)
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 160
- Forks
- 69
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 15
Description
I propose to add optional computation of diagnostics during sampling.
To achieve this, I propose to read the csv files to:
(1) track the proportion of treedepth exceeded
(2) track whether any post-warmup divergences were encountered
(3) track the Bulk & Tail ESS of parameters (with option to specify which to include/exclude)
(4) track the Rhat of parameters (with option to specify which to include/exclude)
To enable efficient incremental parsing of the CSV files, I propose keeping track of how many lines have been read so far and skipping that many lines the next time a read is triggered, storing new samples together with prior samples in an object kept in memory.
To enable resuming this monitoring across R sessions, we could either start the csv parsing from scratch, or we could be writing the contents to a faster binary format (I'm thinking NetCDF) from the outset. This latter has the benefit of leaving the Stan output in a much better format than CSV. If we opted for this, I propose storing both the CSVs and NetCDF fils in a stan_scratch folder (n.b. said folder is involved in the proposed implementations of these FRs as well: Background/asynchronous sampling, Recompile only on changes to output of stanc3 auto-formatter )
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the CSV parsing proposal and the related #424 and #423 discussions, then compare resuming from CSVs with writing NetCDF files in a stan_scratch folder. Done means an agreed design covers incremental diagnostics for treedepth, divergences, ESS, and Rhat, including parameter selection and cross-session monitoring.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100