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
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 59 60 61 62 | |
likelihood_estimator_based_potential(likelihood_estimator, prior, x_o, enable_transform=True)
¶
Returns potential :math:\log(p(x_o|\theta)p(\theta)) for likelihood estimator.
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 |
|---|---|
LikelihoodBasedPotential
|
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 |
|---|---|
RatioBasedPotential
|
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 | |
vector_field_estimator_based_potential(vector_field_estimator, prior, x_o, enable_transform=True, **kwargs)
¶
Returns the potential function gradient for vector field estimators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_field_estimator
|
ConditionalVectorFieldEstimator
|
The neural network modelling the vector field. |
required |
prior
|
Optional[Distribution]
|
The prior distribution. |
required |
x_o
|
Optional[Tensor]
|
The observed data at which to evaluate the vector field. |
required |
enable_transform
|
bool
|
Whether to enable transforms. Not supported yet. |
True
|
**kwargs
|
Additional keyword arguments passed to
|
{}
|
Returns: The potential function and a transformation that maps to unconstrained space.
Source code in sbi/inference/potentials/vector_field_potential.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | |