How to apply Reinforcement Learning techniques using the Neural Network Toolbox R2018a?

7 visualizaciones (últimos 30 días)

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 15 de Nov. de 2023
Editada: MathWorks Support Team el 3 de En. de 2024
 (RL) is an area of machine learning concerned with how software agents ought to act in an environment so as to maximize reward. We currently do not have any documentation examples for RL, but there are several ways to use it with the Neural Network Toolbox R2018a.
A) The attached code example ("nn_reinforcemen.m") uses two neural networks: one for predicting the rewards of different actions, the other for choosing actions that produce the best reward. This approach is a little unusual but valid, and is more limited than other reinforcement learning algorithms:
  1. In reinforcement learning, you usually learn by continually interacting with an “environment” which gives you “states” and “rewards”. But in this script, the “states” (x1) and the “rewards” (t) have been precomputed.
  2. The script starts by training a neural network to learn the reward function. “x1” seems to represent the states, and “x2” represents the actions. Most of the reinforcement learning algorithms I am familiar with do not learn the reward function. Instead, they normally interact with the environment to get rewards, and use these rewards in the loss function.
  3. Because of the approach of learning the reward function, and training on precomputed states “x1”, the algorithm does not learn “online” like most reinforcement learning algorithms. While there some approaches to Reinforcement Learning that work offline (like imitation learning), they are usually inferior to approaches that can “explore” the space of states by repeatedly interacting with the environment.
B) The "adapt" function can be used to perform incremental training of a neural network as new inputs are presented. For more information on the "adapt" function, please run the following command on MATLAB R2018a:
web(fullfile(docroot, 'nnet/ref/adapt.html'))
C) Furthermore, illustrations of Reinforcement Learning or the variant of Q-Learning can be found on File Exchange:
Please note that MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Please follow the below link to search for the required information regarding the current release:

Más respuestas (1)

Emmanouil Tzorakoleftherakis
Emmanouil Tzorakoleftherakis el 1 de Abr. de 2019
Editada: Emmanouil Tzorakoleftherakis el 1 de Abr. de 2019
Starting in R2019a, you can do deep reinforcement learning directly in MATLAB and Simulink with Reinforcement Learning Toolbox, using layers available from Deep Learning Toolbox.
Please see this link for a list of MATLAB/Simulink examples.
For more information, have a look at this video, to see how to use the toolbox to control a walking robot, and this one, which shows how to invert a pendulum system based on image data.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by