Overview of Deep Reinforcement Learning Techniques

In this article, the deep reinforcement learning technology is introduced in detail, and reinforcement learning is divided into three categories (value-based algorithm, policy-based algorithm, and AC algorithm that combines the two) for introduction. First, reinforcement learning is introduced from the perspective of mathematical theory; then, two types of deep reinforcement learning algorithms are introduced from different applicable directions: value-based deep reinforcement learning algorithm DQN and policy-based (Policy-based) Deep reinforcement learning algorithm PG. Finally, the AC (Actor-Critic) algorithm, which is widely used in combination with the first two algorithms, is introduced.



Introduction to Deep Reinforcement Learning

Reinforcement learning is mainly used to learn a strategy to maximize the long-term rewards and punishments obtained by the interaction between the agent and the environment. It is often used to deal with tasks with small state space and action space. In today's era of rapid development of big data and deep learning, for Traditional reinforcement learning cannot solve the problem of high-dimensional data input. In 2013, Mnih V et al. introduced Convolutional Neural Networks (CNN) [1][2][3] in deep learning into reinforcement learning for the first time, and proposed The DQN (Deep Q Learning Network) [4] [5] algorithm has been developed, and research work on Deep Reinforcement Learning (DRL) has been started internationally. In addition, a milestone event in the field of deep reinforcement learning is the Go Century Battle between AlphaGo and Lee Sedol in 2016 [6][7] . The Go program AlphaGo developed by Google's artificial intelligence team DeepMind based on deep reinforcement learning defeated AlphaGo. The world's top Go master Li Shishi shocked the world, and thus opened the curtain of deep reinforcement learning from academia to public awareness.

Deep reinforcement learning combines the feature extraction ability of deep learning [8] (Deep Learning, DL) and the decision-making ability of reinforcement learning (Reinforcement Learning, RL) [9] , and can directly make optimal decision output according to the input multi-dimensional data, It is an end-to-end decision control system, which is widely used in dynamic decision-making, real-time prediction, simulation simulation, game gaming and other fields. It continuously interacts with the environment in real time and takes environmental information as input. To obtain the experience of failure or success to update the parameters of the decision network, so as to learn the optimal decision. The deep reinforcement learning framework is as follows:


In the deep reinforcement learning framework shown in the figure above, the agent interacts with the environment. The agent extracts the features of the environmental state through deep learning, and transmits the results to reinforcement learning for decision-making and execution. After the action is executed, the new state and Rewards and penalties then update the decision-making algorithm. This process is repeated iteratively, and finally the agent learns the strategy to obtain the maximum long-term reward and punishment value.


Mathematical model of deep reinforcement learning  


Reinforcement learning [10] is a decision-making system whose basic idea is to maximize the cumulative reward value obtained by the agent from the environment by interacting with the environment in real time, learning experience in the process of continuous failure and success, Finally, the agent learns the optimal policy (Policy), and the principle process is shown in the following figure:


In the basic model of reinforcement learning shown in the figure above, the agent is the action entity of reinforcement learning. The agent performs an action according to the action selection strategy in the current state. The feedback information updates the parameters of the reinforcement learning algorithm. This process will be repeated and repeated, and finally the agent learns the optimal strategy for completing the target task.

Markov Decision Process (MDP) [11] is a mathematical description of reinforcement learning theory, which can express reinforcement learning problems in the form of probability theory.

Reinforcement learning can be represented in MDP as a tuple containing four attributes: {S,A,P,R}, where:

S 和 A 分别表示智能体的环境状态集和智能体可选择的动作集;


P 表示状态转移概率函数,假设 t 时刻状态为 ,智能体执行动作后以概率转移进入下一个状态 ,则状态转移概率函数可以表示为:
 

R 表示智能体获得的反馈奖励函数,即智能体执行一个动作 a 后获得的即时奖励,可表示为:


一个完整的马尔科夫决策过程可以用下图进行解释:


马尔可夫决策过程样例


上图 MDP 样例中,t 时刻智能体在状态下选择并执行动作,执行完动作后智能体得到环境反馈的奖惩值,并以概率 P 转移到下一个时刻 t+1 的状态智能体在状态下选择并执行动作,同时获得该时刻奖惩值,并以概率 P 转移到下一个时刻 t+2 的状态。这个过程一直会进行下去,直至到达最终目标状态强化学习的目标是使得MDP中长期奖惩值最大化,从而学习到一种选择最优动作的策略,其中,MDP中长期奖惩可以被表示为:


式中折扣因子 表示当前选择的动作对未来影响程度,其值在0到1之间;n 表示MDP中当前状态到目标状态的步数。

MDP中的策略 定义了智能体在状态 S 下到动作的映射关系,即: 。由上式可知长期奖惩的获取必须要等整个MDP过程结束,假若状态集合规模过大,则整个强化学习系统存储量太大,运行太慢,故为了学习最优策略,一个可行的建模方法是利用值函数近似表示,强化学习引入两类价值函数:状态值函数 和动作值函数 。其中,状态值函数表示在状态 S 下获得的期望回报,其数学定义为:

根据上上公式将上公式展开得到:

最终得到的状态价值函数可用贝尔曼(Bellman)方程[12]形式表示:

动作值函数表示在状态 S 下执行动作 a 后获得的期望回报,强化学习的智能体学习目标就是使得动作值函数最大化。动作值函数数学定义如下:


最优动作值函数含义为:所有策略中动作值函数值最大的动作值函数,可表示为:


式中,表示所有策略,表示使动作值函数最大的策略,即最优策略。上式可用Bellman方程表示如下:


式中,r 和分别为在状态 S 下采取动作 a 时的奖惩和对应的下一个状态;为衰减因子;为在状态能获取到最大动作值函数值的动作。



根据马尔可夫特性,状态值函数和动作值函数之间关系如下:


上式表明,状态值函数是动作值函数关于动作 a 的期望。


  基于值函数的深度强化学习算法


基于值函数(Value based)的学习方法是一种求解最优值函数从而获取最优策略的方法。值函数输出的最优动作最终会收敛到确定的动作,从而学习到一种确定性策略。当在动作空间连续的情况下该方法存在维度灾难、计算代价大问题,虽然可以将动作空间离散化处理,但离散间距不易确定,过大会导致算法取不到最优,过小会使得动作空间过大,影响算法速度。因此该方法常被用于离散动作空间下动作策略为确定性的强化学习任务。



基于值函数的深度强化学习算法利用CNN来逼近传统强化学习的动作值函数,代表算法就是DQN算法, DQN算法框架如下:


基于值函数的深度强化学习算法DQN的框架


上图可以看出,基于值函数的深度强化学习算法DQN特征之一就是使用深度卷积神经网络逼近动作值函数。


其中,S 状态和为多维数据;经验池用于存储训练过程中的成败经验。


DQN中有两个相同结构的神经网络,分别称为目标网络和评估网络。目标网络中的输出值表示当在状态 S 下选择动作 a 时的衰减得分,即:


式中,r 和 S' 分别为在状态 S 下采取动作 a 时的得分和对应的下一个状态;为衰减因子;a' 为评估网络输出的 Q 值向量表中在状态 S' 能获取到最大值的动作,为目标网络的权重参数。


评估网络的输出值表示当在状态时采取动作的价值,即:


式中,为评估网络的权重参数。


DQN训练过程中分为三个阶段:

  1. 初始阶段。这时经验池 D 未满,在每一个时刻 t 中随机选择行为获取经验元组,然后将每一步的经验元组存储至经验池。这个阶段主要用来积攒经验,此时DQN的两个网络均不进行训练;

  2. 探索阶段。这一阶段采用了 贪心策略( 从1至0逐渐减少)获取动作,在网络产生决策的同时,又能以一定的概率探索其他可能的最优行为,避免了陷入局部最优解的问题。这个阶段中不断更新经验池中的经验元组,并作为评估网络、目标网络的输入,得到 。然后将两者差值作为损失函数,以梯度下降算法[13][14]更新评估网络的权重参数。为了使训练收敛,目标网络的权重参数更新方式为:每隔一段固定的迭代次数,将评估网络的权重参数复制给目标网络参数;
  3. 利用阶段。这一阶段 降为0,即选择的动作全部来自评估网络的输出。评估网络和目标网络的更新方法和探索阶段一样。

基于值函数的深度强化学习算法DQN按上述三个阶段进行网络训练,当网络训练收敛,评估网络将逼近最优动作值函数,实现最优策略学习目的。



  基于策略梯度的深度强化学习算法


基于策略梯度(Policy based)的深度强化学习算法是一种最大化策略目标函数从而获取最优策略的方法,其相比Value based方法区别在于:

  1. 可以学习到一种最优化随机策略。Policy based方法在训练过程中直接学习策略函数,随着策略梯度方向优化策略函数参数,使得策略目标函数最大化,最终策略输出最优动作分布。策略以一定概率输出动作,每次结果很可能不一样,故不适合应用于像CR频谱协同这类动作策略为确定性的问题中。

  2. Policy based方法容易收敛到局部极值,而Value based探索能力强可以找到最佳值函数。


上述中的策略目标函数用来衡量策略的性能。定义如下:


式中, 为在策略 下处于状态 s 的概率, 为在状态 s 下采用策略 选择动作的概率, 为即时奖惩 。

目前有很多基于策略梯度的深度强化学习算法,像:PG[16],DPG[15],DDPG[17]等。下面以PG算法作为该类算法代表进行介绍,基于PG的深度强化学习算法训练过程如下:


上述基于PG的深度强化学习算法实现过程为:

  1. 随机初始化神经网络参数,即随机定义了一个策略。策略表示在本回合参数为下每个状态对应的动作的概率分布,表明神经网络输出的是动作概率。

  2. 基于PG的深度强化学习算法在每一个回合(episode)完成后才更新网络参数,其中一个回合内的长期奖惩值为 

  3. 基于PG的深度强化学习算法的参数更新方法为:



式中,g 为策略梯度; 为用来控制策略参数更新速度的学习率。

该算法多次迭代后,训练出的神经网络可逼近最优动作值函数,以一定概率输出连续或离散动作空间下的最优动作。


  AC算法


R
=\Sigma^{T-1}_{t=1}{r_t}


AC算法框架被广泛应用于实际强化学习算法中,该框架集成了值函数估计算法和策略搜索算法,是解决实际问题时最常考虑的框架。众所周知的alphago便用了AC框架。而且在强化学习领域最受欢迎的A3C算法,DDPG算法,PPO算法等都是AC框架。

Actor-Critic算法分为两部分,Actor的前身是policy gradient,policy gradient可以轻松地在连续动作空间内选择合适的动作(value-based的Q-learning只能解决离散动作空间的问题)。但是又因为Actor是基于一个episode的return来进行更新的,所以学习效率比较慢。这时候我们发现使用一个value-based的算法作为Critic就可以使用梯度下降方法实现单步更新,这其实可以看做是拿偏差换方差,使得方差变小。这样两种算法相互补充结合就形成了Actor-Critic算法。框架如下:

AC算法框架


Actor 基于概率分布选择行为, Critic 基于 Actor 生成的行为评判得分, Actor 再根据 Critic 的评分修改选行为的概率。下面分析优缺点:



优点:可以进行单步更新,不需要跑完一个episode再更新网络参数,相较于传统的PG更新更快。传统PG对价值的估计虽然是无偏的,但方差较大,AC方法牺牲了一点偏差,但能够有效降低方差;



缺点:Actor的行为取决于 Critic 的Value,但是因为 Critic本身就很难收敛和actor一起更新的话就更难收敛了。(为了解决收敛问题, Deepmind 提出了 Actor Critic 升级版 Deep Deterministic Policy Gradient,后者融合了 DQN 的一些 trick, 解决了收敛难的问题)。


参考文献

  1. Ketkar N . Convolutional Neural Networks[J]. 2017.

  2. Aghdam H H , Heravi E J . Convolutional Neural Networks[M]// Guide to Convolutional Neural Networks. Springer International Publishing, 2017.

  3. Gu, Jiuxiang, Wang, et al. Recent advances in convolutional neural networks[J]. PATTERN RECOGNITION, 2018.

  4. MINH V, KAVUKCUOGLU K, SILVER D, et al.Playing atari with deep reinforcement learning[J].Computer Science, 2013, 1-9.

  5. MNIH V,KAVUKCUOGLU K,SILVER D,et al.Human-level control through deep reinforcement learning[J].Nature,2015,518(7540):529-533.

  6. 曹誉栊. 从AlphaGO战胜李世石窥探人工智能发展方向[J]. 电脑迷, 2018, 115(12):188.

  7. 刘绍桐. 从AlphaGo完胜李世石看人工智能与人类发展[J]. 科学家, 2016(16).

  8. Lecun Y, Bengio Y, Hinton G. Deep learning.[J]. 2015, 521(7553):436.

  9. 赵冬斌,邵坤,朱圆恒,李栋,陈亚冉,王海涛,刘德荣,周彤,王成红.深度强化学习综述:兼论计算机围棋的发展[J].控制理论与应用,2016,33(06):701-717.9

  10. 陈学松, 杨宜民. 强化学习研究综述[J]. 计算机应用研究(8):40-44+50.

  11. L. C. Thomas. Markov Decision Processes[J]. European Journal of Operational Research, 1995, 46(6):792-793.

  12. Bardi M, Bardi M. Optimal control and viscosity solutions of Hamilton-Jacobi-Bellman equations /[M]// Optimal control and viscosity solutions of Hamilton-Jacobi-Bellman equations. 1997.

  13. Ruder S . An overview of gradient descent optimization algorithms[J]. 2016.

  14. R. Johnson, T. Zhang. Accelerating stochastic gradient descent using predictive variance reduction[J]. News in physiological sciences, 2013, 1(3):315-323.

  15. Sutton, Richard& Mcallester, David& Singh, Satinder& Mansour, Yishay. (2000). Policy Gradient Methods for Reinforcement Learning with Function Approximation. Adv. Neural Inf. Process. Syst. 12.

  16. Silver, David& Lever, Guy& Heess, Nicolas& Degris, Thomas& Wierstra, Daan& Riedmiller, Martin. (2014). Deterministic Policy Gradient Algorithms. 31st International Conference on Machine Learning, ICML 2014. 1.

  17. Lillicrap, Timothy& Hunt, Jonathan& Pritzel, Alexander& Heess, Nicolas& Erez, Tom& Tassa, Yuval& Silver, David& Wierstra, Daan. (2015). Continuous control with deep reinforcement learning. CoRR.



团队介绍

阿里巴巴-大淘宝技术 F(x) Team 。使命:前端智能让业务创新更⾼效!愿景:做最懂 AI 的前端团队!

✿  拓展阅读


作者| 江民民 (民超)
编辑|橙子君

本文分享自微信公众号 - 大淘宝技术(AlibabaMTT)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4662964/blog/5567460