Feature idea: cache results of `CmdStanMCMC.summary()`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 198
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Description
The CmdStanMCMC.summary() method runs stansummary under the hood (passing appropriate arguments to the command call). In large models with draws from thousands of quantities, computing this summary can be pretty slow. If one wants to re-use the summary results, the output dataframe needs to stored in a new variable. I think a small quality-of-life feature would be to cache the results of this call within the fit object so in code where .summary() is called more than once on a single fit, we don't re-run the summary (this is something I run into quite often in models I run).
In comparison to the loading we do of draws into memory when accessed via the fit object, the extra memory cost of also storing the summary would be minimal.
Should be an easy implementation if this is something we want to do.
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 at the CmdStanMCMC.summary() entry point and inspect how the fit object currently loads and retains draws. Verify the current stansummary invocation and identify where a summary dataframe can be retained. Done means repeated summary() calls on one fit avoid rerunning stansummary while returning the expected dataframe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100