模仿学习简介
source link: https://mp.weixin.qq.com/s/GKWOEdExtNPQXvWLNYJh9Q
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
点击 上方 “ 深度学习与先进智能决策 ”进入
以爱与青春为名,陪你一路成长
什么是模仿学习?
模仿学习( Imitation Learning ):Learns from expert demonstrations 。也就是基于这些专家经验数据进行学习。Given only the trajectories from expert,The reward function is not available。
难点就是没有 reward
如果人为构建 reward
的话,它很难精确的描述出来。比如像开车时的油门,当前状态给多少?对应的 reward
又是多少?
Imitation Learning vs.Supervise learning
-
The solution may have important structural properties including constraints (for example, robot joint limits), dynamic smoothness and stability, or leading to a coherent, multi-step plan
Imitation Learning
里面你所作的决策可能不是仅仅基于当前的 state
,而可能是由之前的很多信号所决定的。
-
The interaction between the learner’s decisions and its own input distribution (an on-policy versus off-policy distinction)
这个 learner
的 action
作用与环境之后,环境的分布会发生变化。如果按照 experts
的数据进行学习,你不能完全复现数据发生的过程,因为你没有 experts
的 policy
,只是有一些 data
而已。因此 supervised learning
在环境新产生出来的数据分布上面不会工作太好。
-
The increased necessity of minimizing the typically high cost of gathering examples
在 supervised learning
里面, function
是有一个明确的更新目标,而在 model free
的 RL
中,需要大量的数据去 try
,因为反馈的奖励信号只是告诉你好还是不好。但事实上我们经常能拿到一些 expert data
,这些数据的监督信号是要比 RL
自己采样所得到的监督信号要好。
-
参考文献:S. Shalev-Shwartzand S. Ben-David. Understanding Machine Learning: From Theory to Algorithms . Cambridge University Press, 2014.
Imitation Learning Algorithms
Imitation Learning Algorithms
大体上可分为三类: Behavioral Cloning
、 Inverse Reinforcement Learning
、 Generative adversarial imitation Learning
。
-
Behavioral Cloning
行为克隆( behavioral cloning )直接从专家的经验数据中直接学习,学习在什么样的 state
采取什么样的 action
,而不需要去构建奖励函数。学完之后再去预测新的状态下需要采取什么样 action
。
但是当有一些 noise
之后,你 action
差一点点之后,之后的状态也会差一点点,后面就会差地越来越多,因此这种方式会误差累计,导致后面学地越来越不像。
这种情况也叫做 Distributional shift
。有点类似邯郸学步的感觉,并不能学到 expert policy
里面的精髓。
基于上述问题,也有一些算法对其进行改进,比如说 Dagger
算法。它引入了一些自己所产生的 on-policy
数据,混合在 expert data
里面进行学习。
也就是减缓一点 distribution shift
。
那除了这个distribution shift问题之外还有什么问题呢?
-
Non-Markovian behavior
第一个问题就是 expert data
可能并不满足马尔可夫性,可能会基于历史观测信息所做出的决策,而 agent
所做决策基于当前观测,学习策略。那这种学习方式肯定会产生问题,学习起来会比较困难。
-
Multimodal behavior
第二个问题就是 behavior
可能会非常复杂,比如输出是混合高斯模型下的分布(mixture of Gaussians),或者由一些非常复杂的 latent variable models,也就是最后由非常复杂的逻辑推理构成;或者我是从一个分布中采样得到的action,你只能看到我采样得到的action,但是看不到背后的分布,(Autoregressive discretization)。
behavior clone直接,好理解,但是很容易邯郸学步,学不到背后的精髓。那如果我们能把奖励函数学出来的话,我们可以说是朝着核心的policy去学,因此有了inverse reinforcement learning。
-
Inverse Reinforcement Learning
逆强化学习 ( Inverse Reinforcement Learning ),通过 expert trajectories
去反推 reward
,之后再用reward构建学习强化学习智能体,从而得到policy。
那 reward
怎么学呢?简单的用 linear function
、 Neural net
来学:
就是在当前 state
, expert
所采取的动作所能拿到的 reward
比采取其他 action
所能拿到的 action
都高。怎么来做到这样一点呢?
Maximum causal entropy IRL:
如果我们能找到一个 cost function
使得 expert policy
所拿到的 cost
小,而其他 policy
拿到的 cost
大,也就是 expert policy
所能获得更大的奖励,其他的 policy
所能获得的奖励都很小。第一步我们就希望能够找到这样的一个 cost function
。
也就是去寻找一个 cost
,希望 expert
的 cost
比其他的 policy
所拿到的 cost
都要小。在此过程中还希望 causal entropy
(给定一个状态,输出一个动作分布,这个动作分布的的熵) 要大。
从 reward
角度来看就是, expert
的 data
能获得的 reward
比所建模空间中能找到的最好的 reward
还要大。
找到了这个 cost function
之后的话,我们需要去训练智能体, minimize cost
(相当于最大化 reward
):
上述算法流程有个缺点,就是每找到一个 cost function
你都需要去计算 ,而它里面又需要去计算 minmax
,相当于是两层 for
循环。
-
参考文献:ZiebartB D et al. Maximum Entropy Inverse Reinforcement Learning .AAAI. 2008.
-
Generative adversarial imitation learning
生成对抗模仿学习 ( Generative adversarial imitation learning GAIL ) 通过 expert data
与构建的 agent
产生的数据进行对比分析,而使得智能体能够获得 expert
类似的数据,达到学习的目的。
大体思想是希望智能体所产生的数据与专家数据同时送入一个分类器,这个分类器无法将其分开。这样的智能体可以被认为是学习到了专家策略。
GAIL
是将 Agent
引入 GAN
,因此我们需要先来看看 GAN
的 Loss function
:
在 GAN
中我们希望 generate
一些高质量的数据,但是我们不知道什么是高质量的数据,也就是无法对其打分,因此我们需要去 train
一个网络来判别哪些数据是高质量的数据,这个网络就是 discriminator
,那想要训练 discriminator
的话,我们又需要高质量的数据和差的数据,高质量的数据就是给定样本,而差的数据是生成器生成出来的数据。有了打分函数之后我们去训练 generator
就可以了。到此一个循环就完成了。
主要可分为两步:
-
Train a good discriminator
-
Train a good generator to fool the discriminator
GAIL
的 Loss
:
对于 GAIL
多了一个 entropy
,但是步骤也是两步:
-
Train a good cost function
-
Train a good generator to fool the discriminator
-
参考文献:Ho J, ErmonS. Generative adversarial imitation learning . NIPS 2016.
Open Questions
-
How to generalize skills with complex conditions?
-
How to find solutions with guarantees?
-
How to scale up with respect to the number of dimensions? spaces? How to make it tractable?
-
How to perform imitation by multiple agents?
-
How to perform incremental/active learning in IRL?
Performance evaluation
-
How to establish benchmark problems for imitation learning?
-
What metric should be used to evaluate imitation learning methods?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK