Skip to content

lit_sb3.distributions.maskable.base

source module lit_sb3.distributions.maskable.base

Base class for maskable distributions.

Classes

source class MaskableDistribution()

Bases : Distribution, ABC

Methods

  • apply_masking — Eliminate ("mask out") chosen distribution outcomes by setting their probability to 0.

  • proba_distribution_net — Create the layers and parameters that represent the distribution.

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

Eliminate ("mask out") chosen distribution outcomes by setting their probability to 0.

Parameters

  • masks : MaybeMasks — An optional boolean ndarray of compatible shape with the distribution. If True, the corresponding choice's logit value is preserved. If False, it is set to a large negative value, resulting in near 0 probability. If masks is None, any previously applied masking is removed, and the original logits are restored.

source method MaskableDistribution.proba_distribution_net(*args, **kwargs) → nn.Module

Create the layers and parameters that represent the distribution.

Subclasses must define this, but the arguments and return type vary between concrete classes.