q-trader icon indicating copy to clipboard operation
q-trader copied to clipboard

Some possible optimization

Open vedmathai opened this issue 7 years ago • 1 comments

I may be wrong but doesn't mini_batch.append(self.memory.popleft()) do better job than mini_batch.append(self.memory[i]) in

def expReplay(self, batch_size):
	mini_batch = []
	l = len(self.memory)
	for i in xrange(l - batch_size + 1, l):
                 mini_batch.append(self.memory[i])

It is much faster too.

vedmathai avatar Jul 27 '18 18:07 vedmathai

Vedmathai , Your code is very different from the original code. popleft() will remove data from queue . then len(agent.memory) will be 0 . then 1 train / step will become 1 train / 32 steps. The episode loop will become quick , but I don't know what the result will happen.

rockmany2000 avatar Oct 17 '18 10:10 rockmany2000