keras-rl的EpisodeParameterMemory有什么作用?

What does the EpisodeParameterMemory of keras-rl do?

我找到了 keras-rl/examples/cem_cartpole.py 示例,我想了解,但找不到文档。

行是什么

memory = EpisodeParameterMemory(limit=1000, window_length=1)

做什么? limit 是什么,window_length 是什么?增加其中一个/两个参数有什么影响?

EpisodeParameterMemory 是用于 CEM 的特殊 class。从本质上讲,它存储了用于整个情节(因此得名)的策略网络的参数。

关于您的问题:limit 参数只是指定内存可以容纳多少条目。超过此限制后,较旧的条目将被较新的条目替换。

此特定类型的内存中未使用第二个参数(CEM 在 Keras-RL 中有点属于边缘情况,主要作为简单基线存在)。然而,通常情况下,window_length 参数控制将多少观察值连接起来形成 "state"。如果环境不能完全观察到(将其视为将 POMDP 转换为 MDP,或至少近似地),这可能是必要的。例如,Atari 上的 DQN 使用此方法是因为单帧显然不足以推断具有 FF 网络的球的速度。

一般来说,我建议阅读相关论文(同样,CEM 有点例外)。然后应该相对清楚每个参数的含义。我同意 Keras-RL 迫切需要文档,但不幸的是,我现在没有时间处理它。为改善这种情况做出的贡献当然总是受欢迎的 ;)。

聚会有点晚了,但我觉得答案并没有真正回答问题。

我在网上找到这个描述 (https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.html#replay-memory):

We’ll be using experience replay memory for training our DQN. It stores the transitions that the agent observes, allowing us to reuse this data later. By sampling from it randomly, the transitions that build up a batch are decorrelated. It has been shown that this greatly stabilizes and improves the DQN training procedure.

基本上,您观察并保存所有状态转换,以便您以后可以在它们上训练您的网络(而不是必须一直从环境中进行观察)。