1. Introduction to Reinforcement Learning

Activity 1.01: Measuring the Performance of a Random Agent

  1. Import the required libraries – abc, numpy, and gym:

    import abc

    import numpy as np

    import gym

  2. Define the abstract class representing the agent:


    Abstract class representing the agent

    Init with the action space and the function pi returning the action


    class Agent:

        def __init__(self, action_space: gym.spaces.Space):


            Constructor of the agent class.


                action_space (gym.spaces.Space): environment action space


            raise NotImplementedError("This class cannot be instantiated.")


        def pi(self, state: np.ndarray) -> np.ndarray:


            Agent's policy. ...

Get The Reinforcement Learning Workshop 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.