Implementing the replay experience method for the Q-learner class

So, we have implemented a memory system for the agent to store its past experience using a neat cyclic buffer. In this section, we will look at how we can use the experience memory to replay experience in the Q-learner class.

The following code snippet implements the replay_experience method that shows how we sample from the experience memory and call a soon-to-be-implemented method that lets the agent learn from the sampled batch of experiences:

def replay_experience(self, batch_size=REPLAY_BATCH_SIZE):        """        Replays a mini-batch of experience sampled from the Experience Memory        :param batch_size: mini-batch size to sample from the Experience Memory        :return: None        """ experience_batch ...

Get Hands-On Intelligent Agents with OpenAI Gym now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.