malib.rl.pg package
Submodules
malib.rl.pg.config module
malib.rl.pg.policy module
- class malib.rl.pg.policy.PGPolicy(observation_space: Space, action_space: Space, model_config: Dict[str, Any], custom_config: Dict[str, Any], **kwargs)[source]
Bases:
PolicyBuild a REINFORCE policy whose input and output dims are determined by observation_space and action_space, respectively.
- Parameters:
observation_space (spaces.Space) – The observation space.
action_space (spaces.Space) – The action space.
model_config (Dict[str, Any]) – The model configuration dict.
custom_config (Dict[str, Any]) – The custom configuration dict.
is_fixed (bool, optional) – Indicates fixed policy or trainable policy. Defaults to False.
- Raises:
NotImplementedError – Does not support other action space type settings except Box and Discrete.
TypeError – Unexpected action space.
malib.rl.pg.trainer module
- class malib.rl.pg.trainer.PGTrainer(training_config: Dict[str, Any], policy_instance: Optional[Policy] = None)[source]
Bases:
TrainerInitialize a trainer for a type of policies.
- Parameters:
learning_mode (str) – Learning mode inidication, could be off_policy or on_policy.
training_config (Dict[str, Any], optional) – The training configuration. Defaults to None.
policy_instance (Policy, optional) – A policy instance, if None, we must reset it. Defaults to None.