I was going through this implementation of Reinforcement learning where model is being trained to manage the number of bikes at a station.

Here, line 78 represents the loop over all episodes (if I understood correctly). In line 92, the DQN Agent is defined meaning after each episode, the agent will be reset to default parameters.

But shouldn't we define the model before the loop starts because the after each episode, won't all the previous learning be lost if we initialize the class object in each iteration? Am I misinterpreting anything?

  • $\begingroup$ Code doesn't look correct to me. DQN shouldn't be reinitialized every episode (there could be exception for special methods with random search but that is not the case there) $\endgroup$ Mar 26, 2019 at 13:25
  • $\begingroup$ I thought the same. But since all the results are included with visualizations which shows that model actually worked, I am in doubt what could this mean. $\endgroup$ Mar 26, 2019 at 13:28
  • 3
    $\begingroup$ They are not resetting the agent after every episode, that would be ridiculous, the variable called 'episodes' is clumsily chosen, it is a list of episodes that will be performed in a single training session and size of that list is number of training sessions they will perform. The real training is going on when they call train_operator method on line 98, they pass number of episodes there. $\endgroup$
    – Brale
    Mar 26, 2019 at 16:58
  • $\begingroup$ Now I understand. But do we reset the agent after every session? What happens to the previous session learning? $\endgroup$ Mar 27, 2019 at 6:09


You must log in to answer this question.

Browse other questions tagged .