Skip to content

lit_sb3.distributions.multi_categorical

source module lit_sb3.distributions.multi_categorical

MultiCategorical distribution for multi-discrete action spaces.

Classes

source class MultiCategoricalDistribution(action_dims: list[int])

Bases : Distribution

MultiCategorical distribution for multi discrete actions.

Parameters

  • action_dims : list[int] — List of sizes of discrete action spaces

Methods

source method MultiCategoricalDistribution.proba_distribution_net(latent_dim: int) → nn.Module

Create the layer that represents the distribution.

it will be the logits (flattened) of the MultiCategorical distribution. You can then get probabilities using a softmax on each sub-space.

Parameters

  • latent_dim : int — Dimension of the last layer of the policy network (before the action layer)

source method MultiCategoricalDistribution.proba_distribution(action_logits: torch.Tensor) → SelfMultiCategoricalDistribution

source method MultiCategoricalDistribution.log_prob(actions: torch.Tensor) → torch.Tensor

source method MultiCategoricalDistribution.entropy() → torch.Tensor

source method MultiCategoricalDistribution.sample() → torch.Tensor

source method MultiCategoricalDistribution.mode() → torch.Tensor

source method MultiCategoricalDistribution.actions_from_params(action_logits: torch.Tensor, deterministic: bool = False) → torch.Tensor

source method MultiCategoricalDistribution.log_prob_from_params(action_logits: torch.Tensor) → tuple[torch.Tensor, torch.Tensor]