stan-dev / stan-dev/stan

ADVI: Option to save family parameters to JSON

Open
#3,315 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

i/o interface
Dominant language
C++
Stars
2.8k
Forks
388
Avg merge
2d 17h
Merged PRs (30d)
15

Description

Summary:

Currently the mean is saved in the CSV output above the samples, but there is no way to get the estimated (co-)variance out, short of approximating it through the samples.

We could save it to JSON, similar to issues #3181 #3260

Description:

Option to save the non-mean parameters of the family for ADVI. For meanfield this is
https://github.com/stan-dev/stan/blob/9de06d41d0de9201a78c6c3e1de18fbc98496f1d/src/stan/variational/families/normal_meanfield.hpp#L28-L30

For fullrank this is
https://github.com/stan-dev/stan/blob/9de06d41d0de9201a78c6c3e1de18fbc98496f1d/src/stan/variational/families/normal_fullrank.hpp#L28-L31

These could be used to e.g. draw further samples from the approximation from outside the algorithmic run.

Additional Information:

Originally requested on the forums here: https://discourse.mc-stan.org/t/cmdstanpy-variational-how-to-get-density-parameters/37280/

Current Version:

v2.35.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/stan/variational/families/normal_meanfield.hpp and normal_fullrank.hpp at the linked parameter definitions, then trace how ADVI currently writes its CSV output and compare issues #3181 and #3260. Done means providing an option that writes the relevant non-mean family parameters to JSON for both meanfield and fullrank ADVI.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.