rlDQNAgent
Deep Q-network (DQN) reinforcement learning agent
Description
The deep Q-network (DQN) algorithm is an off-policy reinforcement learning method for environments with a discrete action space. A DQN agent trains a Q-value function critic to estimate the value of the optimal policy, while following an epsilon-greedy policy based on the value estimated by the critic (it does not try to directly learn an optimal policy). DQN is a variant of Q-learning that features a target critic and an experience buffer. The DQN agent supports offline training (training from saved data, without an environment).
For more information, Deep Q-Network (DQN) Agent. For more information on the different types of reinforcement learning agents, see Reinforcement Learning Agents.
Creation
Syntax
Description
Create Agent from Observation and Action Specifications
creates a DQN agent for an environment with the given observation and action
specifications, using default initialization options. The critic in the agent uses a
default vector (that is, multi-output) Q-value deep neural network built from the
observation specification agent
= rlDQNAgent(observationInfo
,actionInfo
)observationInfo
and the action
specification actionInfo
. The ObservationInfo
and ActionInfo
properties of agent
are set to
the observationInfo
and actionInfo
input
arguments, respectively.
creates a DQN agent for an environment with the given observation and action
specifications. The agent uses a default network configured using options specified in
the agent
= rlDQNAgent(observationInfo
,actionInfo
,initOpts
)initOpts
object. For more information on the initialization
options, see rlAgentInitializationOptions
.
Create Agent from Critic
creates a DQN agent with the specified critic network using a default option set for a
DQN agent.agent
= rlDQNAgent(critic
)
Specify Agent Options
creates a DQN agent with the specified critic network and sets the agent
= rlDQNAgent(critic
,agentOptions
)AgentOptions
property to the agentOptions
input argument. Use this syntax after
any of the input arguments in the previous syntaxes..
Input Arguments
Properties
Object Functions
train | Train reinforcement learning agents within a specified environment |
sim | Simulate trained reinforcement learning agents within specified environment |
getAction | Obtain action from agent, actor, or policy object given environment observations |
getActor | Extract actor from reinforcement learning agent |
setActor | Set actor of reinforcement learning agent |
getCritic | Extract critic from reinforcement learning agent |
setCritic | Set critic of reinforcement learning agent |
generatePolicyFunction | Generate MATLAB function that evaluates policy of an agent or policy object |
Examples
Version History
Introduced in R2019a
See Also
Apps
Functions
getAction
|getActor
|getCritic
|getModel
|generatePolicyFunction
|generatePolicyBlock
|getActionInfo
|getObservationInfo
Objects
rlDQNAgentOptions
|rlAgentInitializationOptions
|rlVectorQValueFunction
|rlQValueFunction
|rlQAgent
|rlSARSAAgent