我在用:
- keras-rl2:1.0.4
- 张量流:2.4.1
- 麻木:1.19.5
- 健身房 0.18.0
用于为强化学习项目训练 DQN 模型。
我的动作空间包含 60 个离散值:
self.action_space = Discrete(60)
我在 x 步骤后收到此错误:
1901/10000 [====>.........................] - ETA: 1:02 - reward: 6.1348Traceback (most recent call last):
File "D:/GitHub/networth-simulation/rebalancing_simple_discrete.py", line 203, in <module>
dqn.fit(env, nb_steps=5000, visualize=False, verbose=1)
File "D:\GitHub\networth-simulation\venv\lib\site-packages\rl\core.py", line 169, in fit
action = self.forward(observation)
File "D:\GitHub\networth-simulation\venv\lib\site-packages\rl\agents\dqn.py", line 227, in forward
action = self.policy.select_action(q_values=q_values)
File "D:\GitHub\networth-simulation\venv\lib\site-packages\rl\policy.py", line 227, in select_action
action = np.random.choice(range(nb_actions), p=probs)
File "mtrand.pyx", line 928, in numpy.random.mtrand.RandomState.choice
ValueError: probabilities contain NaN
当我使用较少数量的离散动作(<10)时,它不会每次都发生。
我找到了该修复程序,但我不明白如何应用它。我找不到任何文件“numpy/random/mtrand/mtrand.pyx”
有没有人找到解决该错误的方法?