Skip to content

lit_sb3.distributions.maskable.categorical

source module lit_sb3.distributions.maskable.categorical

Maskable categorical distribution for discrete action spaces.

Classes

source class MaskableCategoricalDistribution(action_dim: int)

Bases : MaskableDistribution

Categorical distribution for discrete actions. Supports invalid action masking.

Parameters

  • action_dim : int — Number of discrete actions

Methods

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

Create the layer that represents the distribution.

it will be the logits of the Categorical distribution. You can then get probabilities using a softmax.

Parameters

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

source method MaskableCategoricalDistribution.proba_distribution(action_logits: torch.Tensor) → SelfMaskableCategoricalDistribution

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

source method MaskableCategoricalDistribution.entropy() → torch.Tensor

source method MaskableCategoricalDistribution.sample() → torch.Tensor

source method MaskableCategoricalDistribution.mode() → torch.Tensor

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

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

source method MaskableCategoricalDistribution.apply_masking(masks: MaybeMasks) → None