Skip to content

Commit

Permalink
Merge pull request #704 from stan-dev/extra-pathfinder-config
Browse files Browse the repository at this point in the history
Document new pathfinder config
  • Loading branch information
bob-carpenter authored Jan 16, 2024
2 parents 090ea49 + 37aafdf commit 9071597
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
14 changes: 14 additions & 0 deletions src/cmdstan-guide/pathfinder_config.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ method = pathfinder
history_size = 5 (Default)
num_psis_draws = 1000 (Default)
num_paths = 4 (Default)
psis_resample = 1 (Default)
calculate_lp = 1 (Default)
save_single_paths = 0 (Default)
max_lbfgs_iters = 1000 (Default)
num_draws = 1000 (Default)
Expand Down Expand Up @@ -53,6 +55,18 @@ Can differ from `num_psis_draws`.
- `num_elbo_draws` - Number of Monte Carlo draws to evaluate ELBO.
Must be a positive integer. Default value is $25$.

- `psis_resample` - If True ($1$), perform psis resampling on samples returned
from individual pathfinders. If False ($0$), returns all `num_paths * num_draws samples` draws
from the individual pathfinders.
Valid values: $\{0, 1\}$. Default is $1$ (True).

- `calculate_lp` - If True ($1$), log probabilities of the approximate draws
are calculated and returned with the output. If False ($0$), each pathfinder
will only calculate the lp values needed for the ELBO calculation.
If False, psis resampling cannot be performed and the algorithm returns
`num_paths * num_draws samples`. The output will still contain any lp values
used when calculating ELBO scores within L-BFGS iterations.
Valid values: $\{0, 1\}$. Default is $1$ (True).


## L-BFGS Configuration
Expand Down
18 changes: 10 additions & 8 deletions src/cmdstan-guide/pathfinder_intro.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ method = pathfinder
history_size = 5 (Default)
num_psis_draws = 1000 (Default)
num_paths = 4 (Default)
psis_resample = 1 (Default)
calculate_lp = 1 (Default)
save_single_paths = 0 (Default)
max_lbfgs_iters = 1000 (Default)
num_draws = 1000 (Default)
Expand All @@ -75,20 +77,20 @@ parallel, the uses importance resampling on the set of returned draws
to produce the specified number of draws.
```
Path [1] :Initial log joint density = -11.543343
Path [1] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 1.070e-03 1.707e-05 1.000e+00 1.000e+00 126 -6.220e+00 -6.220e+00
Path [1] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 1.070e-03 1.707e-05 1.000e+00 1.000e+00 126 -6.220e+00 -6.220e+00
Path [1] :Best Iter: [5] ELBO (-6.219833) evaluations: (126)
Path [2] :Initial log joint density = -7.443345
Path [2] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 9.936e-05 3.738e-07 1.000e+00 1.000e+00 126 -6.164e+00 -6.164e+00
Path [2] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 9.936e-05 3.738e-07 1.000e+00 1.000e+00 126 -6.164e+00 -6.164e+00
Path [2] :Best Iter: [5] ELBO (-6.164015) evaluations: (126)
Path [3] :Initial log joint density = -18.986308
Path [3] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 2.996e-04 4.018e-06 1.000e+00 1.000e+00 126 -6.201e+00 -6.201e+00
Path [3] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 2.996e-04 4.018e-06 1.000e+00 1.000e+00 126 -6.201e+00 -6.201e+00
Path [3] :Best Iter: [5] ELBO (-6.200559) evaluations: (126)
Path [4] :Initial log joint density = -8.304453
Path [4] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 2.814e-04 2.034e-06 1.000e+00 1.000e+00 126 -6.221e+00 -6.221e+00
Path [4] : Iter log prob ||dx|| ||grad|| alpha alpha0 # evals ELBO Best ELBO Notes
5 -6.748e+00 2.814e-04 2.034e-06 1.000e+00 1.000e+00 126 -6.221e+00 -6.221e+00
Path [4] :Best Iter: [3] ELBO (-6.161276) evaluations: (126)
Total log probability function evaluations:8404
```
Expand Down

0 comments on commit 9071597

Please sign in to comment.