We begin by importing certain modules from Keras: layers, optimizers, models, and the backend. These modules will help us to construct our neural network:
from keras import layers, models, optimizersfrom keras import backend as K
- We create a class called Critic, whose object takes in the following parameters:
class Critic: """Critic (Value) Model.""" def __init__(self, state_size, action_size): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action """ self.state_size = state_size self.action_size = action_size self.build_model()
- Build a critic (value) network that maps state and action pairs (Q_values), and define input layers, as follows: ...