The actor script is where the policy model is defined. We begin by importing certain modules from Keras: layers, optimizers, models, and the backend. These modules will help us to construct our neural network: Let's start by importing the required functions from Keras.
from keras import layers, models, optimizersfrom keras import backend as K
- We create a class called Actor, whose object takes in the parameters of the state and action size:
class Actor: # """Actor (policy) Model. """ def __init__(self, state_size, action_size): self.state_size = state_size self.action_size = action_size
- The preceding code shows the state size, which represents the dimension of each state, and the action size, which represents the dimensions ...