如何提高前馈网络作为 q 值函数逼近器的性能?

How can I improve the performance of a feedforward network as a q-value function approximator?

我正在尝试通过使用 Q 学习 + 前馈神经网络作为 q 函数逼近器来在 n*n 网格世界域中导航代理。基本上,代理应该找到 best/shortest 到达某个终端目标位置的方法(+10 奖励)。代理采取的每一步都会获得 -1 奖励。在网格世界中,还有一些代理人应该避免的位置(-10 奖励,终端状态)。

到目前为止,我实现了一个 Q 学习算法,该算法将所有 Q 值保存在 Q-table 中,并且代理表现良好。 在下一步中,我想用神经网络替换 Q-table,在代理的每一步之后在线训练。我尝试了一个具有一个隐藏层和四个输出的前馈神经网络,代表网格世界(北、南、东、西)中可能的动作的 Q 值。 作为输入,我使用了一个 nxn 零矩阵,它在代理的当前位置有一个“1”。

为了实现我的目标,我尝试从头开始解决问题:

  1. 使用标准 Q-Learning 探索网格世界,并在 Q-Learning 完成后使用 Q-map 作为网络的训练数据 --> 工作正常

  2. 使用Q-Learning并提供Q-map的更新作为训练数据 对于 NN(batchSize = 1) --> 效果不错

  3. 用NN完全替换Q-Map。 (这就是重点,当它变得有趣时!)

    -> 第一张地图:4 x 4 如上所述,我有 16 "discrete" 个输入,4 个输出,它在隐藏层(学习率:0.05)中与 8 个神经元(relu)一起工作正常。我使用了带有 epsilon 的贪婪策略,在 60 集内从 1 减少到 0.1。 The test scenario is shown here. 标准 qlearning 与 q-map 和 "neural" qlearning 的性能比较(在这种情况下,我使用了 8 个神经元和不同的 dropOut 率)。

总结一下:Neural Q-learning 对小网格效果很好,而且性能还可以和可靠。

-> 更大的地图:10 x 10

现在我尝试将神经网络用于更大的地图。 起初我尝试了这个简单的 case.

在我的例子中,神经网络如下所示:100 个输入; 4 个输出;一个隐藏层中大约有 30 个神经元 (relu);我再次对贪婪策略使用了递减的探索因子;超过 200 集学习率从 0.1 降低到 0.015 以增加稳定性。

起初我遇到了由离散输入向量引起的单个位置之间的收敛和插值问题。 为了解决这个问题,我向向量添加了一些相邻位置,其值取决于它们到当前位置的距离。这大大改善了学习,政策也变得更好了。 24 个神经元的性能如上图所示。

总结:简单的情况被网络解决了,但只需要大量的参数调整(神经元数量、探索因子、学习率)和特殊的输入转换。

现在这是我的questions/problems我还没有解决:

(1) 我的网络能够解决 10 x 10 地图中非常简单的案例和示例,但随着问题变得有点复杂,它会失败。在很可能失败的情况下,网络没有改变来找到正确的策略。 我对任何可以在这种情况下提高性能的想法持开放态度。

(2) 有没有更聪明的方法来转换网络的输入向量?我敢肯定,将相邻位置添加到输入向量一方面可以改善地图上 q 值的插值,但另一方面会使训练 special/important 位置到网络变得更加困难。我已经在早期尝试过标准笛卡尔二维输入(x/y),但失败了。

(3) 除了具有反向传播的前馈网络之外,是否还有另一种网络类型,通常使用 q 函数逼近会产生更好的结果?你见过 FF-nn 在更大的地图上表现良好的项目吗?

众所周知,Q 学习 + 前馈神经网络作为 q 函数逼近器即使在简单问题中也会失败 [Boyan & Moore,1995]。

Rich Sutton 在他的 web site 的常见问题解答中有一个与此相关的问题。

一种可能的解释是 [Barreto & Anderson,2008] 中描述的称为 干扰 的现象:

Interference happens when the update of one state–action pair changes the Q-values of other pairs, possibly in the wrong direction.

Interference is naturally associated with generalization, and also happens in conventional supervised learning. Nevertheless, in the reinforcement learning paradigm its effects tend to be much more harmful. The reason for this is twofold. First, the combination of interference and bootstrapping can easily become unstable, since the updates are no longer strictly local. The convergence proofs for the algorithms derived from (4) and (5) are based on the fact that these operators are contraction mappings, that is, their successive application results in a sequence converging to a fixed point which is the solution for the Bellman equation [14,36]. When using approximators, however, this asymptotic convergence is lost, [...]

Another source of instability is a consequence of the fact that in on-line reinforcement learning the distribution of the incoming data depends on the current policy. Depending on the dynamics of the system, the agent can remain for some time in a region of the state space which is not representative of the entire domain. In this situation, the learning algorithm may allocate excessive resources of the function approximator to represent that region, possibly “forgetting” the previous stored information.

One way to alleviate the interference problem is to use a local function approximator. The more independent each basis function is from each other, the less severe this problem is (in the limit, one has one basis function for each state, which corresponds to the lookup-table case) [86]. A class of local functions that have been widely used for approximation is the radial basis functions (RBFs) [52].

因此,在您的问题 (n*n gridworld) 中,RBF 神经网络应该会产生更好的结果。

参考资料

Boyan, J. A. & Moore, A. W. (1995) 强化学习中的泛化:安全地逼近价值函数。 NIPS-7。加利福尼亚州圣马特奥市:Morgan Kaufmann。

André da Motta Salles Barreto & Charles W. Anderson (2008) 强化学习中价值函数逼近的受限梯度下降算法,人工智能 172 (2008) 454–482