baselines
baselines copied to clipboard
Major Bug in a2c implementation
Discounting of rewards should be for elements before done, not for ones after it. It seems like this is a major error in implementation
Correct way G_{t} = R_{t} + gamma*(R_{t+1}) V_{t} ---> G_{t}
Current Way G_{t} = R_{t} + gamma*(R_{t-1}) V_{t} ---> G_{t}
File utils.py code for discount_with_dones is as follow :
def discount_with_dones(rewards, dones, gamma):
discounted = []
r = 0
for reward, done in zip(rewards[::-1], dones[::-1]):
print ('actual rewards in discount',reward)
print ('looping rewards in discount',r)
print ('Done in discount in discount',done)
r = reward + gamma*r*(1.-done) # fixed off by one bug
discounted.append(r)
return discounted[::-1]
Please let me know, if there is something I have missed . Do comment on my current understanding, irrespective of it being correct or incorrect.
Please respond on the raised bug ticket . . .
I missed ' ::-1' , that it means reversed state.