This page maps each method in
neuralsbi to the paper it comes from and the function that
runs it. For a worked example, read vignette("neuralsbi")
instead.
npe() implements the single-round amortized case.
Conditioning on a new observation costs one forward pass through
posterior(), then sample().npe_sequential() implements truncated proposals. The
result is not amortized and holds only near the observation it was
trained on.nle() implements the single-round case, so repeated
independent observations are a sum over one trained density. Evaluate it
with log_lik() and sample it through
posterior().posterior() uses by default. stan_code()
writes the estimator out as Stan code instead.nre() implements the atomic objective with 10 atoms per
simulation by default. Evaluate it with log_ratio() and
sample it through posterior().Select one through density_estimator= in
npe() or nle(). A closed-form
"linear_gaussian" option is also available: it needs no
torch, is exact for linear-Gaussian models, and serves as a
test oracle.
npe(density_estimator = "mdn") maps x to
the weights, means, and full covariances of a Gaussian mixture over
\(\theta\). n_components
and hidden size it.npe(density_estimator = "maf") is the default.
n_transforms sets the depth.npe(density_estimator = "nsf") implements the
autoregressive form. n_bins and tail_bound
control the spline.sbc() computes the ranks, one parameter at a time, and
plot_sbc() displays them.expected_coverage() turns the SBC ranks into nominal
against empirical coverage at each credible level, and
plot_coverage() displays them. Calibrated posteriors lie on
the diagonal.tarp() runs the test and plot_tarp()
displays it.c2st() runs the procedure Lueckmann et al. (2021) use in
sbibm, so its numbers are comparable with published
benchmark results: a two-hidden-layer ReLU network of
10 * d units per layer, 5-fold cross-validated accuracy,
both sample sets z-scored by the moments of the first. The network
trains on torch, so this classifier needs torch installed.
classifier = "logistic" swaps in cross-validated logistic
regression, which needs no torch and is faster, but is linear: it sees a
shift in location and is close to blind to a difference in spread or
dependence.