The parameters manager

Did you like the parameter configuration file example that you just saw? I hope you did. In this section, we will implement a parameter manger that will help us load, get, and set these parameters as necessary.

We will start by creating a Python class named ParamsMangerthat initializes the paramsmember variable with the dictionary of parameters read from the params_fileusing the JSON Python library, as follows:

#!/usr/bin/env pythonimport JSONclass ParamsManager(object):    def __init__(self, params_file):        """        A class to manage the Parameters. Parameters include configuration parameters and Hyper-parameters        :param params_file: Path to the parameters JSON file        """        self.params = JSON.load(open(params_file, 'r'))

We will ...

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.