-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Pathfinder.jl is lovely, but we probably shouldn't have a code example in there:
docs/tutorials/docs-16-using-turing-external-samplers/index.qmd
Lines 82 to 99 in 2260d61
```{julia} | |
using AdvancedHMC, Pathfinder | |
# Running pathfinder | |
draws = 1_000 | |
result_multi = multipathfinder(model, draws; nruns=8) | |
# Estimating the metric | |
inv_metric = result_multi.pathfinder_results[1].fit_distribution.Σ | |
metric = DenseEuclideanMetric(Matrix(inv_metric)) | |
# Creating an AdvancedHMC NUTS sampler with the custom metric. | |
n_adapts = 1000 # Number of adaptation steps | |
tap = 0.9 # Large target acceptance probability to deal with the funnel structure of the posterior | |
nuts = AdvancedHMC.NUTS(tap; metric=metric) | |
# Sample | |
chain = sample(model, externalsampler(nuts), 10_000; n_adapts=1_000) | |
``` |
Rationale:
-
We want the docs to use the most recent version of Turing.jl, as far as is possible. Pathfinder is the only reverse dep of Turing that we are using*, meaning that if we release a new version of Turing, we need Pathfinder to also release a new version that is compatible with it. We shouldn't expect Pathfinder's maintainers to do this (they may not want to, for whatever reason).
-
We shouldn't be responsible for documenting how another package is used. It's great to point out other packages in the Julia ecosystem that can be used together with Turing, but the question of how to use package X should be documented in package X. Indeed, Pathfinder's docs already contain an example that is remarkably similar to our own: https://mlcolab.github.io/Pathfinder.jl/stable/examples/turing/
* There's also TuringBenchmarking, but that's internal, so we can easily tag a new release whenever we need to.