๐ฒREINFORCE
REINFORCE Williams, 1992 directly learns a parameterized policy, ฯ, which maps states to probability distributions over actions.
Starting with random parameter values, the agent uses this policy to act in an environment and receive rewards. After an episode has finished, the "goodness" of each action, represented by, f(ฯ), is calculated using the episode trajectory. The parameters of the policy are then updated in a direction which makes good actions (f(ฯ)>0) more likely, and bad actions (f(ฯ)<0) less likely. Good actions are reinforced, bad actions are discouraged.
The agent then uses the updated policy to act in the environment, and the training process repeats.
REINFORCE is an on policy algorithm. Only data that is gathered using the current policy can be used to update the parameters. Once the policy parameters have been updated all previous data gathered must be discarded and the collection process started again with the new policy.
There are a number of different approaches to calculating f(ฯ). Method 3, outlined below, is common. It captures the idea that the absolute quality of the actions matters less than their quality relative to some baseline. One option for a baseline is the average of f(ฯ) over the training data (typically one episode trajectory).
Algorithm: REINFORCE with baseline
Methods for calculating f(ฯ)tโ:
See slm_lab/spec/benchmark/reinforce/ for example REINFORCE specs.
Basic Parameters
"agent": {
"name": str,
"algorithm": {
"name": str,
"action_pdtype": str,
"action_policy": str,
"gamma": float,
"training_frequency": int,
"entropy_coef_spec": {...},
},
"memory": {
"name": str,
},
"net": {
"type": str,
"hid_layers": list,
"hid_layers_activation": str,
"optim_spec": dict,
}
},
...
}algorithmnamegeneral paramaction_pdtypegeneral paramaction_policystring specifying which policy to use to act. For example, "Categorical" (for discrete action spaces), "Normal" (for continuous actions spaces with one dimension), or "default" to automatically switch between the two depending on the environment.gammageneral paramtraining_frequencyhow many episodes of data to collect before each training iteration. A common value is 1.entropy_coef_specschedule for entropy coefficient added to the loss to encourage exploration. Example:{"name": "no_decay", "start_val": 0.01, "end_val": 0.01, "start_step": 0, "end_step": 0}center_return(optional, defaultfalse) whether to center returns by subtracting the mean before computing policy gradient. Can improve training stability.
memorynamegeneral param. Compatible types; "OnPolicyReplay", "OnPolicyBatchReplay"
nettypegeneral param. Compatible types; all networks.hid_layersgeneral paramhid_layers_activationgeneral paramoptim_specgeneral param
Advanced Parameters
netrnn_hidden_sizegeneral paramrnn_num_layersgeneral paramseq_lengeneral paramclip_grad_val: general paramlr_scheduler_spec: optional learning rate scheduler configgpu: general param
Last updated
Was this helpful?