Q-Learning experience replay: how to feed the neural network?Why random sample from replay for DQN?What is “experience replay” and what are its benefits?Deep Reinforcent Learning Model, experience replayQ learning neural network experience replay problemIs this a Q-learning algorithm or just brute force?How does a Q algorithm consider future rewards?Experience Replay ExplainPrioritized Experience Replay - why to approximate the Density Function?Difference between advantages of Experience Replay in DQN2013 paperWhy is my loss function for DQN converging too quickly?Potential-based reward shaping in DQN reinforcement learning

Can there be a single technologically advanced nation, in a continent full of non-technologically advanced nations?

How to write a 12-bar blues melody

Has a commercial or military jet bi-plane ever been manufactured?

Point of the Dothraki's attack in GoT S8E3?

What does 'made on' mean here?

29er Road Tire?

Where can I go to avoid planes overhead?

Why has the UK chosen to use Huawei infrastructure when Five Eyes allies haven't?

Will 700 more planes a day fly because of the Heathrow expansion?

In Russian, how do you idiomatically express the idea of the figurative "overnight"?

Could the black hole photo be a gravastar?

How to increase the size of the cursor in Lubuntu 19.04?

Frequency of specific viral sequence in .BAM or .fastq

How can I support myself financially as a 17 year old with a loan?

Why are UK Bank Holidays on Mondays?

I have a unique character that I'm having a problem writing. He's a virus!

Nominativ or Akkusativ

Can you Ready a Bard spell to release it after using Battle Magic?

Why does this derived table improve performance?

How should I tell my manager I'm not paying for an optional after work event I'm not going to?

How can internet speed be 10 times slower without a router than when using a router?

What to use instead of cling film to wrap pastry

Adding a limit in NDSolve to avoid division by zero

Decoupling cap routing on a 4 layer PCB



Q-Learning experience replay: how to feed the neural network?


Why random sample from replay for DQN?What is “experience replay” and what are its benefits?Deep Reinforcent Learning Model, experience replayQ learning neural network experience replay problemIs this a Q-learning algorithm or just brute force?How does a Q algorithm consider future rewards?Experience Replay ExplainPrioritized Experience Replay - why to approximate the Density Function?Difference between advantages of Experience Replay in DQN2013 paperWhy is my loss function for DQN converging too quickly?Potential-based reward shaping in DQN reinforcement learning













0












$begingroup$


I'm trying to replicate the DQN Atari experiment. Actually my DQN isn't performing well; checking another one's codes, I saw something about experience replay which I don't understand. First, when you define your CNN, in the first layer you have to specify the size (I'm using Keras + Tensorflow so in my case it's something like (105, 80, 4), which corresponds to height, width and number of images I feed my CNN.). In the codes I revisited, when they get the minibatch from the memory, I see they usually fed the CNN without "packing" it on 4 batches. How it is possible? I mean for example if you get 32 random sampled experiences, don't you need to make batches of 4 before feeding it?
Here are an example of what I'm saying: https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/replay_buffer.py
https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/deep_Q.py
In this code, that's how he/she stores the experiences:



def add(self, s, a, r, d, s2):
"""Add an experience to the buffer"""
# S represents current state, a is action,
# r is reward, d is whether it is the end,
# and s2 is next state
experience = (s, a, r, d, s2)
if self.count < self.buffer_size:
self.buffer.append(experience)
self.count += 1
else:
self.buffer.popleft()
self.buffer.append(experience)


Then when you need to use them:



 def sample(self, batch_size):
"""Samples a total of elements equal to batch_size from buffer
if buffer contains enough elements. Otherwise return all elements"""

batch = []

if self.count < batch_size:
batch = random.sample(self.buffer, self.count)
else:
batch = random.sample(self.buffer, batch_size)

# Maps each experience in batch in batches of states, actions, rewards
# and new states
s_batch, a_batch, r_batch, d_batch, s2_batch = list(map(np.array, list(zip(*batch))))

return s_batch, a_batch, r_batch, d_batch, s2_batch


Ok, so now you have a batch of 32 states, actions, rewards, done and next states.



This is how you feed the state batch (s_batch) and next state batch (s2_batch) to the CNN:



def train(self, s_batch, a_batch, r_batch, d_batch, s2_batch, observation_num):
"""Trains network to fit given parameters"""
batch_size = s_batch.shape[0]
targets = np.zeros((batch_size, NUM_ACTIONS))

for i in range(batch_size):
targets[i] = self.model.predict(s_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
fut_action = self.target_model.predict(s2_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
targets[i, a_batch[i]] = r_batch[i]
if d_batch[i] == False:
targets[i, a_batch[i]] += DECAY_RATE * np.max(fut_action)

loss = self.model.train_on_batch(s_batch, targets)

# Print the loss every 10 iterations.
if observation_num % 10 == 0:
print("We had a loss equal to ", loss)


In my code (https://bitbucket.org/jocapal/dqn_public/src/master/Deimos_v2_13.py) I get a batch of 32 experiences; then make small batches of 4 experiences and feed the CNN. My question is: am I doing it wrong? And if so, how can I feed 32 experiences when my CNN is waiting for 4 experiences?



Another example of what I'm saying: https://yanpanlau.github.io/2016/07/10/FlappyBird-Keras.html










share|improve this question











$endgroup$
















    0












    $begingroup$


    I'm trying to replicate the DQN Atari experiment. Actually my DQN isn't performing well; checking another one's codes, I saw something about experience replay which I don't understand. First, when you define your CNN, in the first layer you have to specify the size (I'm using Keras + Tensorflow so in my case it's something like (105, 80, 4), which corresponds to height, width and number of images I feed my CNN.). In the codes I revisited, when they get the minibatch from the memory, I see they usually fed the CNN without "packing" it on 4 batches. How it is possible? I mean for example if you get 32 random sampled experiences, don't you need to make batches of 4 before feeding it?
    Here are an example of what I'm saying: https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/replay_buffer.py
    https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/deep_Q.py
    In this code, that's how he/she stores the experiences:



    def add(self, s, a, r, d, s2):
    """Add an experience to the buffer"""
    # S represents current state, a is action,
    # r is reward, d is whether it is the end,
    # and s2 is next state
    experience = (s, a, r, d, s2)
    if self.count < self.buffer_size:
    self.buffer.append(experience)
    self.count += 1
    else:
    self.buffer.popleft()
    self.buffer.append(experience)


    Then when you need to use them:



     def sample(self, batch_size):
    """Samples a total of elements equal to batch_size from buffer
    if buffer contains enough elements. Otherwise return all elements"""

    batch = []

    if self.count < batch_size:
    batch = random.sample(self.buffer, self.count)
    else:
    batch = random.sample(self.buffer, batch_size)

    # Maps each experience in batch in batches of states, actions, rewards
    # and new states
    s_batch, a_batch, r_batch, d_batch, s2_batch = list(map(np.array, list(zip(*batch))))

    return s_batch, a_batch, r_batch, d_batch, s2_batch


    Ok, so now you have a batch of 32 states, actions, rewards, done and next states.



    This is how you feed the state batch (s_batch) and next state batch (s2_batch) to the CNN:



    def train(self, s_batch, a_batch, r_batch, d_batch, s2_batch, observation_num):
    """Trains network to fit given parameters"""
    batch_size = s_batch.shape[0]
    targets = np.zeros((batch_size, NUM_ACTIONS))

    for i in range(batch_size):
    targets[i] = self.model.predict(s_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
    fut_action = self.target_model.predict(s2_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
    targets[i, a_batch[i]] = r_batch[i]
    if d_batch[i] == False:
    targets[i, a_batch[i]] += DECAY_RATE * np.max(fut_action)

    loss = self.model.train_on_batch(s_batch, targets)

    # Print the loss every 10 iterations.
    if observation_num % 10 == 0:
    print("We had a loss equal to ", loss)


    In my code (https://bitbucket.org/jocapal/dqn_public/src/master/Deimos_v2_13.py) I get a batch of 32 experiences; then make small batches of 4 experiences and feed the CNN. My question is: am I doing it wrong? And if so, how can I feed 32 experiences when my CNN is waiting for 4 experiences?



    Another example of what I'm saying: https://yanpanlau.github.io/2016/07/10/FlappyBird-Keras.html










    share|improve this question











    $endgroup$














      0












      0








      0





      $begingroup$


      I'm trying to replicate the DQN Atari experiment. Actually my DQN isn't performing well; checking another one's codes, I saw something about experience replay which I don't understand. First, when you define your CNN, in the first layer you have to specify the size (I'm using Keras + Tensorflow so in my case it's something like (105, 80, 4), which corresponds to height, width and number of images I feed my CNN.). In the codes I revisited, when they get the minibatch from the memory, I see they usually fed the CNN without "packing" it on 4 batches. How it is possible? I mean for example if you get 32 random sampled experiences, don't you need to make batches of 4 before feeding it?
      Here are an example of what I'm saying: https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/replay_buffer.py
      https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/deep_Q.py
      In this code, that's how he/she stores the experiences:



      def add(self, s, a, r, d, s2):
      """Add an experience to the buffer"""
      # S represents current state, a is action,
      # r is reward, d is whether it is the end,
      # and s2 is next state
      experience = (s, a, r, d, s2)
      if self.count < self.buffer_size:
      self.buffer.append(experience)
      self.count += 1
      else:
      self.buffer.popleft()
      self.buffer.append(experience)


      Then when you need to use them:



       def sample(self, batch_size):
      """Samples a total of elements equal to batch_size from buffer
      if buffer contains enough elements. Otherwise return all elements"""

      batch = []

      if self.count < batch_size:
      batch = random.sample(self.buffer, self.count)
      else:
      batch = random.sample(self.buffer, batch_size)

      # Maps each experience in batch in batches of states, actions, rewards
      # and new states
      s_batch, a_batch, r_batch, d_batch, s2_batch = list(map(np.array, list(zip(*batch))))

      return s_batch, a_batch, r_batch, d_batch, s2_batch


      Ok, so now you have a batch of 32 states, actions, rewards, done and next states.



      This is how you feed the state batch (s_batch) and next state batch (s2_batch) to the CNN:



      def train(self, s_batch, a_batch, r_batch, d_batch, s2_batch, observation_num):
      """Trains network to fit given parameters"""
      batch_size = s_batch.shape[0]
      targets = np.zeros((batch_size, NUM_ACTIONS))

      for i in range(batch_size):
      targets[i] = self.model.predict(s_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
      fut_action = self.target_model.predict(s2_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
      targets[i, a_batch[i]] = r_batch[i]
      if d_batch[i] == False:
      targets[i, a_batch[i]] += DECAY_RATE * np.max(fut_action)

      loss = self.model.train_on_batch(s_batch, targets)

      # Print the loss every 10 iterations.
      if observation_num % 10 == 0:
      print("We had a loss equal to ", loss)


      In my code (https://bitbucket.org/jocapal/dqn_public/src/master/Deimos_v2_13.py) I get a batch of 32 experiences; then make small batches of 4 experiences and feed the CNN. My question is: am I doing it wrong? And if so, how can I feed 32 experiences when my CNN is waiting for 4 experiences?



      Another example of what I'm saying: https://yanpanlau.github.io/2016/07/10/FlappyBird-Keras.html










      share|improve this question











      $endgroup$




      I'm trying to replicate the DQN Atari experiment. Actually my DQN isn't performing well; checking another one's codes, I saw something about experience replay which I don't understand. First, when you define your CNN, in the first layer you have to specify the size (I'm using Keras + Tensorflow so in my case it's something like (105, 80, 4), which corresponds to height, width and number of images I feed my CNN.). In the codes I revisited, when they get the minibatch from the memory, I see they usually fed the CNN without "packing" it on 4 batches. How it is possible? I mean for example if you get 32 random sampled experiences, don't you need to make batches of 4 before feeding it?
      Here are an example of what I'm saying: https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/replay_buffer.py
      https://github.com/yilundu/DQN-DDQN-on-Space-Invaders/blob/master/deep_Q.py
      In this code, that's how he/she stores the experiences:



      def add(self, s, a, r, d, s2):
      """Add an experience to the buffer"""
      # S represents current state, a is action,
      # r is reward, d is whether it is the end,
      # and s2 is next state
      experience = (s, a, r, d, s2)
      if self.count < self.buffer_size:
      self.buffer.append(experience)
      self.count += 1
      else:
      self.buffer.popleft()
      self.buffer.append(experience)


      Then when you need to use them:



       def sample(self, batch_size):
      """Samples a total of elements equal to batch_size from buffer
      if buffer contains enough elements. Otherwise return all elements"""

      batch = []

      if self.count < batch_size:
      batch = random.sample(self.buffer, self.count)
      else:
      batch = random.sample(self.buffer, batch_size)

      # Maps each experience in batch in batches of states, actions, rewards
      # and new states
      s_batch, a_batch, r_batch, d_batch, s2_batch = list(map(np.array, list(zip(*batch))))

      return s_batch, a_batch, r_batch, d_batch, s2_batch


      Ok, so now you have a batch of 32 states, actions, rewards, done and next states.



      This is how you feed the state batch (s_batch) and next state batch (s2_batch) to the CNN:



      def train(self, s_batch, a_batch, r_batch, d_batch, s2_batch, observation_num):
      """Trains network to fit given parameters"""
      batch_size = s_batch.shape[0]
      targets = np.zeros((batch_size, NUM_ACTIONS))

      for i in range(batch_size):
      targets[i] = self.model.predict(s_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
      fut_action = self.target_model.predict(s2_batch[i].reshape(1, 84, 84, NUM_FRAMES), batch_size = 1)
      targets[i, a_batch[i]] = r_batch[i]
      if d_batch[i] == False:
      targets[i, a_batch[i]] += DECAY_RATE * np.max(fut_action)

      loss = self.model.train_on_batch(s_batch, targets)

      # Print the loss every 10 iterations.
      if observation_num % 10 == 0:
      print("We had a loss equal to ", loss)


      In my code (https://bitbucket.org/jocapal/dqn_public/src/master/Deimos_v2_13.py) I get a batch of 32 experiences; then make small batches of 4 experiences and feed the CNN. My question is: am I doing it wrong? And if so, how can I feed 32 experiences when my CNN is waiting for 4 experiences?



      Another example of what I'm saying: https://yanpanlau.github.io/2016/07/10/FlappyBird-Keras.html







      python reinforcement-learning q-learning dqn keras-rl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 11 at 14:23







      Joaquin

















      asked Apr 11 at 14:13









      JoaquinJoaquin

      12




      12




















          1 Answer
          1






          active

          oldest

          votes


















          1












          $begingroup$

          Input is a 4D tensor [batch_size, height, width, channels] . Single state is already 4 frames stacked together so when you sample a state from the experience replay you sample a 3D tensor [height, width, channels]. When you sample 32 states you actually sample 32 of those 3D tensors and feed them directly to the network. For more details on preprocessing refer to the page 6 of the original DQN paper found here.






          share|improve this answer









          $endgroup$












          • $begingroup$
            But what about breaking the correlations between samples? If I did that way there would be a strong correlation between images (as stated here: datascience.stackexchange.com/questions/24921/…) and here, in pages 4-5: cs.toronto.edu/~vmnih/docs/dqn.pdf
            $endgroup$
            – Joaquin
            Apr 11 at 16:48










          • $begingroup$
            Joaquin, you missunderstood. 4 frames stacked together are a single state. You need it because the environment is partially observable. For example, if you play Pong and you only have a single frame, you won't know if the ball goes right or left. You need few frames stacked together to get that information. Those few frames together are a single state. Correlation part applies between different states which are different frames stacked together. You would get "strong correlation" only if you keep giving state after state as the input, 4 frames together won't cause such correlation.
            $endgroup$
            – Brale_
            Apr 11 at 17:13











          • $begingroup$
            Thanks Brale_ for you clarification. I'll try that way and see if it works. Thanks for your time!
            $endgroup$
            – Joaquin
            Apr 11 at 17:21











          • $begingroup$
            Just for clarify: when talking about the minibatches you pick randomly from the memory batch, it's referring to packs of 4 states, not to single states, right?
            $endgroup$
            – Joaquin
            Apr 12 at 1:32










          • $begingroup$
            Yes, you pick 32 packs of 4 states, of course those 4 states have to be in order they happened to have full information, the thing that I talked about with Pong.
            $endgroup$
            – Brale_
            Apr 12 at 7:36












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "557"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f49128%2fq-learning-experience-replay-how-to-feed-the-neural-network%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1












          $begingroup$

          Input is a 4D tensor [batch_size, height, width, channels] . Single state is already 4 frames stacked together so when you sample a state from the experience replay you sample a 3D tensor [height, width, channels]. When you sample 32 states you actually sample 32 of those 3D tensors and feed them directly to the network. For more details on preprocessing refer to the page 6 of the original DQN paper found here.






          share|improve this answer









          $endgroup$












          • $begingroup$
            But what about breaking the correlations between samples? If I did that way there would be a strong correlation between images (as stated here: datascience.stackexchange.com/questions/24921/…) and here, in pages 4-5: cs.toronto.edu/~vmnih/docs/dqn.pdf
            $endgroup$
            – Joaquin
            Apr 11 at 16:48










          • $begingroup$
            Joaquin, you missunderstood. 4 frames stacked together are a single state. You need it because the environment is partially observable. For example, if you play Pong and you only have a single frame, you won't know if the ball goes right or left. You need few frames stacked together to get that information. Those few frames together are a single state. Correlation part applies between different states which are different frames stacked together. You would get "strong correlation" only if you keep giving state after state as the input, 4 frames together won't cause such correlation.
            $endgroup$
            – Brale_
            Apr 11 at 17:13











          • $begingroup$
            Thanks Brale_ for you clarification. I'll try that way and see if it works. Thanks for your time!
            $endgroup$
            – Joaquin
            Apr 11 at 17:21











          • $begingroup$
            Just for clarify: when talking about the minibatches you pick randomly from the memory batch, it's referring to packs of 4 states, not to single states, right?
            $endgroup$
            – Joaquin
            Apr 12 at 1:32










          • $begingroup$
            Yes, you pick 32 packs of 4 states, of course those 4 states have to be in order they happened to have full information, the thing that I talked about with Pong.
            $endgroup$
            – Brale_
            Apr 12 at 7:36
















          1












          $begingroup$

          Input is a 4D tensor [batch_size, height, width, channels] . Single state is already 4 frames stacked together so when you sample a state from the experience replay you sample a 3D tensor [height, width, channels]. When you sample 32 states you actually sample 32 of those 3D tensors and feed them directly to the network. For more details on preprocessing refer to the page 6 of the original DQN paper found here.






          share|improve this answer









          $endgroup$












          • $begingroup$
            But what about breaking the correlations between samples? If I did that way there would be a strong correlation between images (as stated here: datascience.stackexchange.com/questions/24921/…) and here, in pages 4-5: cs.toronto.edu/~vmnih/docs/dqn.pdf
            $endgroup$
            – Joaquin
            Apr 11 at 16:48










          • $begingroup$
            Joaquin, you missunderstood. 4 frames stacked together are a single state. You need it because the environment is partially observable. For example, if you play Pong and you only have a single frame, you won't know if the ball goes right or left. You need few frames stacked together to get that information. Those few frames together are a single state. Correlation part applies between different states which are different frames stacked together. You would get "strong correlation" only if you keep giving state after state as the input, 4 frames together won't cause such correlation.
            $endgroup$
            – Brale_
            Apr 11 at 17:13











          • $begingroup$
            Thanks Brale_ for you clarification. I'll try that way and see if it works. Thanks for your time!
            $endgroup$
            – Joaquin
            Apr 11 at 17:21











          • $begingroup$
            Just for clarify: when talking about the minibatches you pick randomly from the memory batch, it's referring to packs of 4 states, not to single states, right?
            $endgroup$
            – Joaquin
            Apr 12 at 1:32










          • $begingroup$
            Yes, you pick 32 packs of 4 states, of course those 4 states have to be in order they happened to have full information, the thing that I talked about with Pong.
            $endgroup$
            – Brale_
            Apr 12 at 7:36














          1












          1








          1





          $begingroup$

          Input is a 4D tensor [batch_size, height, width, channels] . Single state is already 4 frames stacked together so when you sample a state from the experience replay you sample a 3D tensor [height, width, channels]. When you sample 32 states you actually sample 32 of those 3D tensors and feed them directly to the network. For more details on preprocessing refer to the page 6 of the original DQN paper found here.






          share|improve this answer









          $endgroup$



          Input is a 4D tensor [batch_size, height, width, channels] . Single state is already 4 frames stacked together so when you sample a state from the experience replay you sample a 3D tensor [height, width, channels]. When you sample 32 states you actually sample 32 of those 3D tensors and feed them directly to the network. For more details on preprocessing refer to the page 6 of the original DQN paper found here.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 11 at 15:22









          Brale_Brale_

          1111




          1111











          • $begingroup$
            But what about breaking the correlations between samples? If I did that way there would be a strong correlation between images (as stated here: datascience.stackexchange.com/questions/24921/…) and here, in pages 4-5: cs.toronto.edu/~vmnih/docs/dqn.pdf
            $endgroup$
            – Joaquin
            Apr 11 at 16:48










          • $begingroup$
            Joaquin, you missunderstood. 4 frames stacked together are a single state. You need it because the environment is partially observable. For example, if you play Pong and you only have a single frame, you won't know if the ball goes right or left. You need few frames stacked together to get that information. Those few frames together are a single state. Correlation part applies between different states which are different frames stacked together. You would get "strong correlation" only if you keep giving state after state as the input, 4 frames together won't cause such correlation.
            $endgroup$
            – Brale_
            Apr 11 at 17:13











          • $begingroup$
            Thanks Brale_ for you clarification. I'll try that way and see if it works. Thanks for your time!
            $endgroup$
            – Joaquin
            Apr 11 at 17:21











          • $begingroup$
            Just for clarify: when talking about the minibatches you pick randomly from the memory batch, it's referring to packs of 4 states, not to single states, right?
            $endgroup$
            – Joaquin
            Apr 12 at 1:32










          • $begingroup$
            Yes, you pick 32 packs of 4 states, of course those 4 states have to be in order they happened to have full information, the thing that I talked about with Pong.
            $endgroup$
            – Brale_
            Apr 12 at 7:36

















          • $begingroup$
            But what about breaking the correlations between samples? If I did that way there would be a strong correlation between images (as stated here: datascience.stackexchange.com/questions/24921/…) and here, in pages 4-5: cs.toronto.edu/~vmnih/docs/dqn.pdf
            $endgroup$
            – Joaquin
            Apr 11 at 16:48










          • $begingroup$
            Joaquin, you missunderstood. 4 frames stacked together are a single state. You need it because the environment is partially observable. For example, if you play Pong and you only have a single frame, you won't know if the ball goes right or left. You need few frames stacked together to get that information. Those few frames together are a single state. Correlation part applies between different states which are different frames stacked together. You would get "strong correlation" only if you keep giving state after state as the input, 4 frames together won't cause such correlation.
            $endgroup$
            – Brale_
            Apr 11 at 17:13











          • $begingroup$
            Thanks Brale_ for you clarification. I'll try that way and see if it works. Thanks for your time!
            $endgroup$
            – Joaquin
            Apr 11 at 17:21











          • $begingroup$
            Just for clarify: when talking about the minibatches you pick randomly from the memory batch, it's referring to packs of 4 states, not to single states, right?
            $endgroup$
            – Joaquin
            Apr 12 at 1:32










          • $begingroup$
            Yes, you pick 32 packs of 4 states, of course those 4 states have to be in order they happened to have full information, the thing that I talked about with Pong.
            $endgroup$
            – Brale_
            Apr 12 at 7:36
















          $begingroup$
          But what about breaking the correlations between samples? If I did that way there would be a strong correlation between images (as stated here: datascience.stackexchange.com/questions/24921/…) and here, in pages 4-5: cs.toronto.edu/~vmnih/docs/dqn.pdf
          $endgroup$
          – Joaquin
          Apr 11 at 16:48




          $begingroup$
          But what about breaking the correlations between samples? If I did that way there would be a strong correlation between images (as stated here: datascience.stackexchange.com/questions/24921/…) and here, in pages 4-5: cs.toronto.edu/~vmnih/docs/dqn.pdf
          $endgroup$
          – Joaquin
          Apr 11 at 16:48












          $begingroup$
          Joaquin, you missunderstood. 4 frames stacked together are a single state. You need it because the environment is partially observable. For example, if you play Pong and you only have a single frame, you won't know if the ball goes right or left. You need few frames stacked together to get that information. Those few frames together are a single state. Correlation part applies between different states which are different frames stacked together. You would get "strong correlation" only if you keep giving state after state as the input, 4 frames together won't cause such correlation.
          $endgroup$
          – Brale_
          Apr 11 at 17:13





          $begingroup$
          Joaquin, you missunderstood. 4 frames stacked together are a single state. You need it because the environment is partially observable. For example, if you play Pong and you only have a single frame, you won't know if the ball goes right or left. You need few frames stacked together to get that information. Those few frames together are a single state. Correlation part applies between different states which are different frames stacked together. You would get "strong correlation" only if you keep giving state after state as the input, 4 frames together won't cause such correlation.
          $endgroup$
          – Brale_
          Apr 11 at 17:13













          $begingroup$
          Thanks Brale_ for you clarification. I'll try that way and see if it works. Thanks for your time!
          $endgroup$
          – Joaquin
          Apr 11 at 17:21





          $begingroup$
          Thanks Brale_ for you clarification. I'll try that way and see if it works. Thanks for your time!
          $endgroup$
          – Joaquin
          Apr 11 at 17:21













          $begingroup$
          Just for clarify: when talking about the minibatches you pick randomly from the memory batch, it's referring to packs of 4 states, not to single states, right?
          $endgroup$
          – Joaquin
          Apr 12 at 1:32




          $begingroup$
          Just for clarify: when talking about the minibatches you pick randomly from the memory batch, it's referring to packs of 4 states, not to single states, right?
          $endgroup$
          – Joaquin
          Apr 12 at 1:32












          $begingroup$
          Yes, you pick 32 packs of 4 states, of course those 4 states have to be in order they happened to have full information, the thing that I talked about with Pong.
          $endgroup$
          – Brale_
          Apr 12 at 7:36





          $begingroup$
          Yes, you pick 32 packs of 4 states, of course those 4 states have to be in order they happened to have full information, the thing that I talked about with Pong.
          $endgroup$
          – Brale_
          Apr 12 at 7:36


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Data Science Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f49128%2fq-learning-experience-replay-how-to-feed-the-neural-network%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

          Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?