sbi.neural_nets.posterior_score_nn

sbi.neural_nets.posterior_score_nn#

posterior_score_nn(model='mlp', sde_type='ve', z_score_theta='independent', z_score_x='independent', hidden_features=100, num_layers=5, embedding_net=Identity(), time_emb_type='sinusoidal', t_embedding_dim=32, **kwargs)[source]#

Build util function that builds a ScoreEstimator object for score-based posteriors.

Parameters:
  • sde_type (str) – SDE type used, which defines the mean and std functions. One of: - ‘vp’: Variance preserving. - ‘subvp’: Sub-variance preserving. - ‘ve’: Variance exploding. Defaults to ‘ve’.

  • model (Literal['mlp', 'ada_mlp', 'transformer', 'transformer_cross_attn'] | ~sbi.utils.vector_field_utils.VectorFieldNet) –

    Type of regression network. One of: - ‘mlp’: Fully connected feed-forward network. - ‘ada_mlp’: Fully connected feed-forward with adaptive

    layer normalization for conditioning.

    • ’transformer’: Transformer network.

    • ’transformer_cross_attention’: Transformer with cross-attention.

    • nn.Module: Custom network

    Defaults to ‘mlp’.

  • z_score_theta (Literal['independent', 'structured', 'transform_to_unconstrained', 'none'] | None) – Whether to z-score thetas passing into the network, can be one of: - none, or None: do not z-score. - independent: z-score each dimension independently. - structured: treat dimensions as related, therefore compute mean and std over the entire batch, instead of per-dimension. Should be used when each sample is, for example, a time series or an image.

  • z_score_x (Literal['independent', 'structured', 'transform_to_unconstrained', 'none'] | None) – Whether to z-score xs passing into the network, same options as z_score_theta.

  • hidden_features (int) – Number of hidden units per layer. Defaults to 100.

  • embedding_net (Module) – Embedding network for x (conditioning variable). Defaults to nn.Identity().

  • time_emb_type (Literal['sinusoidal', 'fourier']) – Type of time embedding. Defaults to ‘sinusoidal’.

  • t_embedding_dim (int) – Embedding dimension of diffusion time. Defaults to 32.

  • **kwargs (Any) – Additional estimator / network arguments. Valid keys are defined by ScoreEstimatorConfig; unknown keys raise TypeError.

  • num_layers (int)

Returns:

Constructor function for NPSE.

Return type:

Callable