lit_sb3.distributions.gaussian
source module lit_sb3.distributions.gaussian
Diagonal Gaussian distribution for continuous actions.
Classes
-
DiagGaussianDistribution — Gaussian distribution with diagonal covariance matrix, for continuous actions.
source class DiagGaussianDistribution(action_dim: int)
Bases : Distribution
Gaussian distribution with diagonal covariance matrix, for continuous actions.
Parameters
-
action_dim : int — Dimension of the action space.
Methods
-
proba_distribution_net — Create the layers and parameter that represent the distribution.
-
proba_distribution — Create the distribution given its parameters (mean, std).
-
log_prob — Get the log probabilities of actions according to the distribution.
-
log_prob_from_params — Compute the log probability of taking an action.
source method DiagGaussianDistribution.proba_distribution_net(latent_dim: int, log_std_init: float = 0.0) → tuple[nn.Module, nn.Parameter]
Create the layers and parameter that represent the distribution.
one output will be the mean of the Gaussian, the other parameter will be the standard deviation (log std in fact to allow negative values).
Parameters
-
latent_dim : int — Dimension of the last layer of the policy (before the action layer)
-
log_std_init : float — Initial value for the log standard deviation
source method DiagGaussianDistribution.proba_distribution(mean_actions: torch.Tensor, log_std: torch.Tensor) → SelfDiagGaussianDistribution
Create the distribution given its parameters (mean, std).
Parameters
-
mean_actions : torch.Tensor — Mean of the action distribution.
-
log_std : torch.Tensor — Log standard deviation of the action distribution.
source method DiagGaussianDistribution.log_prob(actions: torch.Tensor) → torch.Tensor
Get the log probabilities of actions according to the distribution.
Note that you must first call the proba_distribution() method.
Parameters
-
actions : torch.Tensor — Actions taken.
source method DiagGaussianDistribution.entropy() → torch.Tensor | None
source method DiagGaussianDistribution.sample() → torch.Tensor
source method DiagGaussianDistribution.mode() → torch.Tensor
source method DiagGaussianDistribution.actions_from_params(mean_actions: torch.Tensor, log_std: torch.Tensor, deterministic: bool = False) → torch.Tensor
source method DiagGaussianDistribution.log_prob_from_params(mean_actions: torch.Tensor, log_std: torch.Tensor) → tuple[torch.Tensor, torch.Tensor]
Compute the log probability of taking an action.
given the distribution parameters.
Parameters
-
mean_actions : torch.Tensor — Mean of the action distribution.
-
log_std : torch.Tensor — Log standard deviation of the action distribution.