Critic Networks#
This module defines various critic (value function) network architectures used in reinforcement learning, including deterministic, probabilistic, and Bayesian variants.
Descriptions#
CriticNet: A basic deterministic Q-network estimating expected returns.
ValueNet: A simplified Q-network for value estimation, ignoring action input.
CriticNetProbabilistic: Outputs both mean and uncertainty in Q-values.
BNNCriticNet: A Bayesian Q-network using the local reparameterization trick.
EMstyle: An encoder network for expectation-maximization-style latent modeling.
DQNNet: A Q-network architecture designed for discrete action spaces (e.g., DQN).
QuantileCriticNet: A quantile regression-based critic network for distributional RL.
Classes#
- class objectrl.nets.critic_nets.CriticNet(dim_state: int, dim_act: int, depth: int = 3, width: int = 256, act: Literal['relu', 'crelu'] = 'relu', has_norm: bool = False)[source]#
Bases:
ModuleDeterministic Critic Network (Q-network). Estimates the expected return (Q-value) for a given state-action pair.
- Parameters:
dim_state (int) – Dimension of observation space.
dim_act (int) – Dimension of action space.
depth (int) – Number of hidden layers.
width (int) – Width of each hidden layer.
act (str) – Activation function to use.
has_norm (bool) – Whether to include normalization layers.
- class objectrl.nets.critic_nets.ValueNet(dim_state: int, dim_act: int, depth: int = 3, width: int = 256, act: str = 'relu', has_norm: bool = False)[source]#
Bases:
CriticNetValue network for estimating V(s) without action input.
Inherits from CriticNet but ignores action dimensions by setting dim_act to 0. Suitable for use in value-based methods like PPO or baseline estimation.
- Parameters:
dim_state (int) – Dimension of the input state.
dim_act (int) – Unused, kept for compatibility (should be 0).
depth (int) – Number of hidden layers in the network.
width (int) – Width (number of units) in each hidden layer.
act (str) – Activation function to use (“relu” or “crelu”).
has_norm (bool) – Whether to apply normalization (e.g., LayerNorm).
- class objectrl.nets.critic_nets.CriticNetProbabilistic(dim_state: int, dim_act: int, depth: int = 3, width: int = 256, act: Literal['relu', 'crelu'] = 'relu', has_norm: bool = False)[source]#
Bases:
ModuleProbabilistic Critic Network.
- Parameters:
dim_state (int) – Observation space dimension.
dim_act (int) – Action space dimension.
depth (int) – Number of hidden layers.
width (int) – Width of each hidden layer.
act (str) – Activation function to use.
has_norm (bool) – Whether to use normalization layers.
- class objectrl.nets.critic_nets.BNNCriticNet(dim_state: int, dim_act: int, depth: int = 3, width: int = 256, act: Literal['relu', 'crelu'] = 'relu', has_norm: bool = False)[source]#
Bases:
ModuleA Bayesian Critic Network (Q-network).
- Parameters:
dim_state (int) – Observation space dimension.
dim_act (int) – Action space dimension.
depth (int) – Number of hidden layers.
width (int) – Width of each hidden layer.
act (Literal["relu", "crelu"]) – Activation function to use.
has_norm (bool) – Whether to include normalization layers.
- class objectrl.nets.critic_nets.EMstyle(dim_state: int, dim_act: int, depth: int = 3, width: int = 256, act: Literal['relu', 'crelu'] = 'relu', has_norm: bool = False)[source]#
Bases:
ModuleEncoder network for EM-style models.
- Parameters:
dim_state (int) – Observation space dimension.
dim_act (int) – Action space dimension.
depth (int) – Number of hidden layers.
width (int) – Hidden layer width and output dimensionality.
act (str) – Activation function to use.
has_norm (bool) – Whether to use normalization layers.
- class objectrl.nets.critic_nets.DQNNet(dim_state: int, dim_act: int, depth: int = 3, width: int = 256, act: str = 'relu', has_norm: bool = False)[source]#
Bases:
ModuleDeterministic Critic Network (Q-network).
- Parameters:
dim_state (int) – Dimension of observation space.
dim_act (int) – Dimension of action space.
depth (int) – Number of hidden layers.
width (int) – Width of each hidden layer.
act (str) – Activation function to use.
has_norm (bool) – Whether to include normalization layers.
- class objectrl.nets.critic_nets.QuantileCriticNet(dim_state: int, dim_act: int, depth: int, width: int = 256, act: Literal['relu', 'crelu'] = 'relu', has_norm: bool = True)[source]#
Bases:
ModuleQuantile Critic Network for Distributional RL. Estimates the quantile values for given state-action pairs.
- Parameters:
dim_state (int) – Dimension of observation space.
dim_act (int) – Dimension of action space.
depth (int) – Number of hidden layers.
width (int) – Width of each hidden layer.
act (str) – Activation function to use.
has_norm (bool) – Whether to include normalization layers.