main content

options for td3 agent -凯发k8网页登录

options for td3 agent

since r2020a

description

use an rltd3agentoptions object to specify options for twin-delayed deep deterministic policy gradient (td3) agents. to create a td3 agent, use rltd3agent.

for more information see twin-delayed deep deterministic (td3) policy gradient agents.

for more information on the different types of reinforcement learning agents, see reinforcement learning agents.

creation

description

opt = rltd3agentoptions creates an options object for use as an argument when creating a td3 agent using all default options. you can modify the object properties using dot notation.

example

opt = rltd3agentoptions(name=value) creates the options set opt and sets its properties using one or more name-value arguments. for example, rltd3agentoptions(discountfactor=0.95) creates an option set with a discount factor of 0.95. you can specify multiple name-value arguments.

properties

noise model options, specified as a gaussianactionnoise object or an ornsteinuhlenbeckactionnoise object. for more information on noise models, see noise models.

for an agent with multiple actions, if the actions have different ranges and units, it is likely that each action requires different noise model parameters. if the actions have similar ranges and units, you can set the noise parameters for all actions to the same value.

for example, for an agent with two actions, set the standard deviation of each action to a different value while using the same decay rate for both standard deviations.

opt = rltd3agentoptions;
opt.explorationmodel.standarddeviation = [0.1 0.2];
opt.explorationmodel.standarddeviationdecayrate = 1e-4;

to use ornstein-uhlenbeck action noise, first create a default ornsteinuhlenbeckactionnoise object. then, specify any nondefault model properties using dot notation.

opt = rltd3agentoptions;
opt.explorationmodel = rl.option.ornsteinuhlenbeckactionnoise;
opt.explorationmodel.standarddeviation = 0.05;

target smoothing noise model options, specified as a gaussianactionnoise object. this model helps the policy exploit actions with high q-value estimates. for more information on noise models, see noise models.

for an agent with multiple actions, if the actions have different ranges and units, it is likely that each action requires different smoothing noise model parameters. if the actions have similar ranges and units, you can set the noise parameters for all actions to the same value.

for example, for an agent with two actions, set the standard deviation of each action to a different value while using the same decay rate for both standard deviations.

opt = rltd3agentoptions;
opt.targetpolicysmoothmodel.standarddeviation = [0.1 0.2];
opt.targetpolicysmoothmodel.standarddeviationdecayrate = 1e-4;

number of steps between policy updates, specified as a positive integer.

actor optimizer options, specified as an rloptimizeroptions object. it allows you to specify training parameters of the actor approximator such as learning rate, gradient threshold, as well as the optimizer algorithm and its parameters. for more information, see rloptimizeroptions and rloptimizer.

example: actoroptimizeroptions = rloptimizeroptions(learnrate=2e-3)

critic optimizer options, specified as an rloptimizeroptions object. it allows you to specify training parameters of the critic approximator such as learning rate, gradient threshold, as well as the optimizer algorithm and its parameters. for more information, see rloptimizeroptions and rloptimizer.

example: criticoptimizeroptions = rloptimizeroptions(learnrate=5e-3)

batch data regularizer options, specified as an rlbehaviorcloningregularizeroptions object. these options are typically used to train the agent offline, from existing data. if you leave this option empty, no regularizer is used.

for more information, see .

example: batchdataregularizeroptions = rlbehaviorcloningregularizeroptions(behaviorcloningregularizerweight=10)

smoothing factor for target actor and critic updates, specified as a positive scalar less than or equal to 1. for more information, see .

example: targetsmoothfactor=1e-2

number of steps between target actor and critic updates, specified as a positive integer. for more information, see .

example: targetupdatefrequency=5

option for clearing the experience buffer before training, specified as a logical value.

example: resetexperiencebufferbeforetraining=true

maximum batch-training trajectory length when using a recurrent neural network, specified as a positive integer. this value must be greater than 1 when using a recurrent neural network and 1 otherwise.

example: sequencelength=4

size of random experience mini-batch, specified as a positive integer. during each training episode, the agent randomly samples experiences from the experience buffer when computing gradients for updating the critic properties. large mini-batches reduce the variance when computing gradients but increase the computational effort.

example: minibatchsize=128

number of future rewards used to estimate the value of the policy, specified as a positive integer. specifically, ifnumstepstolookahead is equal to n, the target value of the policy at a given step is calculated adding the rewards for the following n steps and the discounted estimated value of the state that caused the n-th reward. this target is also called n-step return.

note

when using a recurrent neural network for the critic, numstepstolookahead must be 1.

for more information, see [1], chapter 7.

example: numstepstolookahead=3

experience buffer size, specified as a positive integer. during training, the agent computes updates using a mini-batch of experiences randomly sampled from the buffer.

example: experiencebufferlength=1e6

sample time of agent, specified as a positive scalar or as -1. setting this parameter to -1 allows for event-based simulations.

within a simulink® environment, the rl agent block in which the agent is specified to execute every sampletime seconds of simulation time. if sampletime is -1, the block inherits the sample time from its parent subsystem.

within a matlab® environment, the agent is executed every time the environment advances. in this case, sampletime is the time interval between consecutive elements in the output experience returned by sim or train. if sampletime is -1, the time interval between consecutive elements in the returned output experience reflects the timing of the event that triggers the agent execution.

example: sampletime=-1

discount factor applied to future rewards during training, specified as a positive scalar less than or equal to 1.

example: discountfactor=0.9

object functions

rltd3agenttwin-delayed deep deterministic (td3) policy gradient reinforcement learning agent

examples

create an rltd3agentoptions object that specifies the mini-batch size.

opt = rltd3agentoptions(minibatchsize=48)
opt = 
  rltd3agentoptions with properties:
                             sampletime: 1
                         discountfactor: 0.9900
                       explorationmodel: [1x1 rl.option.gaussianactionnoise]
                 experiencebufferlength: 10000
                          minibatchsize: 48
                         sequencelength: 1
                  actoroptimizeroptions: [1x1 rl.option.rloptimizeroptions]
                 criticoptimizeroptions: [1x2 rl.option.rloptimizeroptions]
                    numstepstolookahead: 1
                  policyupdatefrequency: 2
                targetpolicysmoothmodel: [1x1 rl.option.gaussianactionnoise]
                     targetsmoothfactor: 0.0050
                  targetupdatefrequency: 2
            batchdataregularizeroptions: []
    resetexperiencebufferbeforetraining: 0
                             infotosave: [1x1 struct]

you can modify options using dot notation. for example, set the agent sample time to 0.5.

opt.sampletime = 0.5;

algorithms

references

[1] sutton, richard s., and andrew g. barto. reinforcement learning: an introduction. second edition. adaptive computation and machine learning. cambridge, mass: the mit press, 2018.

version history

introduced in r2020a
网站地图