parameters: (self, size)
return_statement: return [prestates, actions, rewards, poststates, terminals]
docstring: Take n Transitions from the memory.
          One transition includes (state, action, reward, state)
          Returns ndarray with 4 lists inside (at Tambet's request)
          @param size: size of the minibatch (in our case it should be 32)
docstring_summary: Take n Transitions from the memory.
          One transition includes (state, action, reward, state)
          Returns ndarray with 4 lists inside (at Tambet's request)
docstring_tokens: Take n Transitions from the memory . One transition includes ( state action reward state ) Returns ndarray with 4 lists inside ( at Tambet s request )
function: def get_minibatch(self, size):
          """
          Take n Transitions from the memory.
          One transition includes (state, action, reward, state)
          Returns ndarray with 4 lists inside (at Tambet's request)
          @param size: size of the minibatch (in our case it should be 32)
          """
          prestates = np.empty((size, 4, self.img_size, self.img_size), dtype = np.float32)
          actions = np.empty((size, 1), dtype=np.int32)
          rewards = np.empty((size, 1), dtype=np.float32)
          terminals = np.empty((size, 1), dtype=np.float32)
          poststates = np.empty((size, 4, self.img_size, self.img_size), dtype = np.float32)
  
          #: Pick random n indices and save dictionary if not terminal state
          j = 0
          while j < size:
              i = random.randint(0, np.min([self.count, self.size]) - 1)
  
              # we don't want to take frames that are just after our rewrite point
              while (i > (self.count % self.size) and (i-(self.count % self.size)) < 4) or self.terminals[i] == 100:
                  i = random.randint(0, np.min([self.count, self.size]) - 1)
  
              # add a state into the batch unless it is an endstate
              if not self.terminals[i]:
                  prestates[j, ...] = self.get_state(i)
                  actions[j] = [self.actions[i]]
                  rewards[j] = [self.rewards[i]]
                  poststates[j, ...] = self.get_state(i + 1)
                  j += 1
              else:
                  print "We have a problem!! We selected an endstate!"
  
          return [prestates, actions, rewards, poststates, terminals]
function_tokens: def get_minibatch ( self , size ) : prestates = np . empty ( ( size , 4 , self . img_size , self . img_size ) , dtype = np . float32 ) actions = np . empty ( ( size , 1 ) , dtype = np . int32 ) rewards = np . empty ( ( size , 1 ) , dtype = np . float32 ) terminals = np . empty ( ( size , 1 ) , dtype = np . float32 ) poststates = np . empty ( ( size , 4 , self . img_size , self . img_size ) , dtype = np . float32 ) #: Pick random n indices and save dictionary if not terminal state j = 0 while j < size : i = random . randint ( 0 , np . min ( [ self . count , self . size ] ) - 1 ) # we don't want to take frames that are just after our rewrite point while ( i > ( self . count % self . size ) and ( i - ( self . count % self . size ) ) < 4 ) or self . terminals [ i ] == 100 : i = random . randint ( 0 , np . min ( [ self . count , self . size ] ) - 1 ) # add a state into the batch unless it is an endstate if not self . terminals [ i ] : prestates [ j , ... ] = self . get_state ( i ) actions [ j ] = [ self . actions [ i ] ] rewards [ j ] = [ self . rewards [ i ] ] poststates [ j , ... ] = self . get_state ( i + 1 ) j += 1 else : print "We have a problem!! We selected an endstate!" return [ prestates , actions , rewards , poststates , terminals ]