posterior_network¶
- probly.transformation.posterior_network(encoder: Predictor[In, Out], latent_dim: int, num_classes: int, class_counts: list | None = None, num_flows: int = 6) PosteriorNetworkPredictor[In, Out][source]¶
Create a Posterior Network predictor from an encoder based on [CZugnerGunnemann20].
- Parameters:
encoder – The backbone predictor mapping inputs to a latent embedding.
latent_dim – Dimensionality of the encoder’s output embedding.
num_classes – Number of target classes.
class_counts – Per-class sample counts for the prior Dirichlet concentration. Default is None.
num_flows – Number of affine coupling steps in the normalizing flow. Default is 6.
- Returns:
The posterior network predictor outputting a DirichletDistribution.