API reference#
Prior and simulator#
Uniform distribution in multiple dimensions. |
|
Wrap a sequence of PyTorch distributions into a joint PyTorch distribution. |
|
Return PyTorch distribution-like prior from user-provided prior. |
|
Returns a simulator that meets the requirements for usage in sbi. |
|
Distribution that restricts the prior distribution to a smaller region. |
|
Classifier to estimate regions of the prior that give good simulation results. |
|
Returns pairs \((\theta, x)\) by sampling proposal and running simulations. |
Neural nets#
Returns a function that builds a classifier for learning density ratios. |
|
Returns a function that builds a density estimator for learning the likelihood. |
|
Returns a function that builds a density estimator for learning the marginal. |
|
Build util function that builds a FlowMatchingEstimator object for flow-based posteriors. |
|
Returns a function that builds a density estimator for learning the posterior. |
|
Build util function that builds a ScoreEstimator object for score-based posteriors. |
Embedding nets#
Embedding network that uses 1D causal convolutions. |
|
Convolutional embedding network (1D or 2D convolutions). |
|
Fully-connected multi-layer neural network to be used as embedding network. |
|
Embedding network backed by a stack of Linear Recurrent Unit (LRU) blocks. |
|
|
Permutation invariant embedding network. |
Residual neural network mapping vector-like data to a fixed-size vector. |
|
Residual neural network mapping image-like data to a fixed sized vector. |
|
Transformer-based embedding network for time series and image data. |
Training#
Balanced Neural Ratio Estimation (BNRE) as in Delaunoy et al. (2022) [1]. |
|
Flow Matching Posterior Estimation (FMPE) [1]. |
|
Utility class for training a marginal density estimator $p(x)$. |
|
Monte-Carlo Approximate Bayesian Computation (Rejection ABC). |
|
Mixed Neural Likelihood Estimation for discrete and continuous data [1]. |
|
Method that can infer discrete and continuous parameters (Mixed NPE). |
|
Neural Likelihood Estimation (NLE) as in Papamakarios et al. (2019) [1]. |
|
Neural Posterior Estimation algorithm as in Papamakarios et al. (2016) [1]. |
|
Neural Posterior Estimation algorithm (NPE-B) as in Lueckmann et al. (2017) [1]. |
|
Neural Posterior Estimation algorithm (NPE-C) as in Greenberg et al. (2019) [1]. |
|
Neural Posterior Score Estimation (NPSE) [1, 2]. |
|
Neural Ratio Estimation (NRE-A / AALR) as in Hermans et al. (2020) [1]. |
|
Neural Ratio Estimation (NRE-B / SRE) as in Durkan et al. (2020) [1]. |
|
Neural Ratio Estimation (NRE-C / CNRE) as in Miller et al. (2022) [1]. |
|
Sequential Monte Carlo Approximate Bayesian Computation. |
Potentials#
Returns potential \(\log(p(x_o|\theta)p(\theta))\) for likelihood estimator. |
|
Returns $log(p(x_o|theta)p(theta))$ for mixed likelihood-based methods. |
|
Returns the potential for posterior-based methods. |
|
Returns the potential for ratio-based methods. |
|
Returns the potential function gradient for vector field estimators. |
Posteriors#
Posterior based on neural networks that directly estimate the posterior (NPE). |
|
Wrapper for bundling together different posterior instances into an ensemble. |
|
Provides importance sampling to sample from the posterior. |
|
Provides MCMC to sample from the posterior. |
|
Provides rejection sampling to sample from the posterior. |
|
Posterior based on flow- or score-matching estimators. |
|
Provides VI (Variational Inference) to sample from the posterior. |
Posterior Parameters#
Parameters for initializing DirectPosterior. |
|
|
Parameters for initializing ImportanceSamplingPosterior. |
Parameters for initializing MCMCPosterior. |
|
Parameters for initializing RejectionPosterior. |
|
Parameters for initializing VectorFieldPosterior. |
|
Parameters for VIPosterior, supporting both single-x and amortized VI. |
Diagnostics#
Perform hypothesis test to check if |
|
Misspecification test based on MMD in data- or embedding space. |
|
Return uniformity checks and data-averaged posterior checks for SBC. |
|
check the obtained TARP credibitlity levels and expected coverage probabilities. |
|
Return negative log prob of true parameters under the posterior. |
|
L-C2ST: Local Classifier Two-Sample Test. |
|
Run simulation-based calibration (SBC) or expected coverage. |
|
Estimates coverage of samples given true values thetas with the TARP method. |
Analysis#
Identify the active subspace of the posterior for sensitivity analyses. |
|
Returns the conditional correlation matrix of a distribution. |
|
Plot conditional distribution given all other parameters. |
|
Returns potential function that can be used to sample the conditional potential. |
|
Plot samples in a row showing 1D marginals of selected dimensions. |
|
Plot samples in a 2D grid showing marginals and pairwise marginals. |
|
Plots the expected coverage probability (ECP) against the credibility level,alpha, for a given alpha grid. |
|
Probability - Probability (P-P) plot for hypothesis tests to assess the validity of one (or several) estimator(s). |
|
Probability - Probability (P-P) plot for LC2ST. |
|
Plot simulation-based calibration ranks as empirical CDFs or histograms. |
Utilities#
Returns function that thresholds a density at a particular 1-quantile. |
|
Builds a transform that is applied to parameters during MCMC. |
|
Return potential after a transformation by adding the log-abs-determinant. |