original_docstring: Randomly sample a batch of experiences from memory.
docstring: Randomly sample a batch of experiences from memory.
docstring_tokens: Randomly sample a batch of experiences from memory .
code: def sample(self,batchSize):
          """Randomly sample a batch of experiences from memory."""
          experiences = random.sample(self.memory, k=batchSize)        
              
          states = np.vstack([e.state for e in experiences if e is not None])
          actions = np.vstack([e.action for e in experiences if e is not None])
          rewards = np.vstack([e.reward for e in experiences if e is not None])
          nextStates = np.vstack([e.next_state for e in experiences if e is not None])
          dones = np.vstack([e.done for e in experiences if e is not None])
    
          return (states, actions, rewards, nextStates, dones)
code_tokens: def sample ( self , batchSize ) : experiences = random . sample ( self . memory , k = batchSize ) states = np . vstack ( [ e . state for e in experiences if e is not None ] ) actions = np . vstack ( [ e . action for e in experiences if e is not None ] ) rewards = np . vstack ( [ e . reward for e in experiences if e is not None ] ) nextStates = np . vstack ( [ e . next_state for e in experiences if e is not None ] ) dones = np . vstack ( [ e . done for e in experiences if e is not None ] ) return ( states , actions , rewards , nextStates , dones )
short_docstring: Randomly sample a batch of experiences from memory.
short_docstring_tokens: Randomly sample a batch of experiences from memory .
comment: """Randomly sample a batch of experiences from memory."""