Potentials¶
posterior_estimator_based_potential(posterior_estimator, prior, x_o, enable_transform=True)
¶
Returns the potential for posterior-based methods.
It also returns a transformation that can be used to transform the potential into unconstrained space.
The potential is the same as the log-probability of the posterior_estimator
, but
it is set to \(-\inf\) outside of the prior bounds.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
posterior_estimator
|
ConditionalDensityEstimator
|
The neural network modelling the posterior. |
required |
prior
|
Distribution
|
The prior distribution. |
required |
x_o
|
Optional[Tensor]
|
The observed data at which to evaluate the posterior. |
required |
enable_transform
|
bool
|
Whether to transform parameters to unconstrained space.
When False, an identity transform will be returned for |
True
|
Returns:
Type | Description |
---|---|
PosteriorBasedPotential
|
The potential function and a transformation that maps |
TorchTransform
|
to unconstrained space. |
Source code in sbi/inference/potentials/posterior_based_potential.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
likelihood_estimator_based_potential(likelihood_estimator, prior, x_o, enable_transform=True)
¶
Returns potential \(\log(p(x_o|\theta)p(\theta))\) for likelihood-based methods.
It also returns a transformation that can be used to transform the potential into unconstrained space.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
likelihood_estimator
|
ConditionalDensityEstimator
|
The density estimator modelling the likelihood. |
required |
prior
|
Distribution
|
The prior distribution. |
required |
x_o
|
Optional[Tensor]
|
The observed data at which to evaluate the likelihood. |
required |
enable_transform
|
bool
|
Whether to transform parameters to unconstrained space.
When False, an identity transform will be returned for |
True
|
Returns:
Type | Description |
---|---|
Callable
|
The potential function \(p(x_o|\theta)p(\theta)\) and a transformation that maps |
TorchTransform
|
to unconstrained space. |
Source code in sbi/inference/potentials/likelihood_based_potential.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
ratio_estimator_based_potential(ratio_estimator, prior, x_o, enable_transform=True)
¶
Returns the potential for ratio-based methods.
It also returns a transformation that can be used to transform the potential into unconstrained space.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ratio_estimator
|
Module
|
The neural network modelling likelihood-to-evidence ratio. |
required |
prior
|
Distribution
|
The prior distribution. |
required |
x_o
|
Optional[Tensor]
|
The observed data at which to evaluate the likelihood-to-evidence ratio. |
required |
enable_transform
|
bool
|
Whether to transform parameters to unconstrained space.
When False, an identity transform will be returned for |
True
|
Returns:
Type | Description |
---|---|
Callable
|
The potential function and a transformation that maps |
TorchTransform
|
to unconstrained space. |
Source code in sbi/inference/potentials/ratio_based_potential.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
score_estimator_based_potential(score_estimator, prior, x_o, enable_transform=False)
¶
Returns the potential function gradient for score estimators.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score_estimator
|
ConditionalScoreEstimator
|
The neural network modelling the score. |
required |
prior
|
Optional[Distribution]
|
The prior distribution. |
required |
x_o
|
Optional[Tensor]
|
The observed data at which to evaluate the score. |
required |
enable_transform
|
bool
|
Whether to enable transforms. Not supported yet. |
False
|
Source code in sbi/inference/potentials/score_based_potential.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|