Body: <p>I was going through <a href="https://github.com/ianxxiao/reinforcement_learning_project/blob/master/code/training.py" rel="nofollow noreferrer">this</a> implementation of Reinforcement learning where model is being trained to manage the number of bikes at a station.</p>
  
  <p>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.</p>
  
  <p>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?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-26T13:25:40.433Z
Comments.Text: 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)
Comments.UserDisplayName: mirror2image
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-26T13:28:26.623Z
Comments.Text: 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.
Comments.UserDisplayName: mayank agrawal
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-26T16:58:40.727Z
Comments.Text: 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.
Comments.UserDisplayName: Brale
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-27T06:09:20.160Z
Comments.Text: Now I understand. But do we reset the agent after every session? What happens to the previous session learning?
Comments.UserDisplayName: mayank agrawal
Tags: <reinforcement-learning><q-learning><dqn>
Title: Do we need to reset the DQN network after every episode?
UserDisplayName: mayank agrawal
ThreadText: # Do we need to reset the DQN network after every episode?
  
  (Asked by: username_0 on 2019-03-26)
  
  I was going through [this](https://github.com/ianxxiao/reinforcement_learning_project/blob/master/code/training.py) 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?
  
  **Tags:** reinforcement-learning, q-learning, dqn
  > **Comments:**
  > **username_1**: 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)  
  > **username_0**: 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.  
  > **username_2**: 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.  
  > **username_0**: Now I understand. But do we reset the agent after every session? What happens to the previous session learning?  
  
  ---
  
  ## 0 answers
  
  