Implementing the Q_Learner class's discretize method

Let's take a moment to understand how we are discretizing the observation space. The simplest, and yet an effective, way to discretize the observation space (and a metric space in general) is to divide the span of the range of values into a finite set of values called bins. The span/range of values is given by the difference between the maximum possible value and the minimum possible value in each dimension of the space. Once we calculate the span, we can divide it by the NUM_DISCRETE_BINS that we have decided on to get the width of the bin. We calculated the bin width in the __init__ function because it does not change with every new observation. The discretize(self, obs) function receives ...

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.