October 2018
Intermediate to advanced
472 pages
10h 57m
English
Let's define an agent/function approximator.
The agent is nothing but a simple deep neural network that takes in the state (four variables) of the CartPole system and returns the maximum possible reward for each of the two actions.
The first, second, and third layers are simple Dense layers with 16 neurons and with activation as relu.
The final layer is a Dense layer with two neurons equal to the number of possible actions:
def agent(states, actions): """Simple Deep Neural Network.""" model = Sequential() model.add(Dense(16, input_dim=states)) model.add(Activation('relu')) model.add(Dense(16)) model.add(Activation('relu')) model.add(Dense(16)) model.add(Activation('relu')) model.add(Dense(actions)) model.add(Activation('linear')) ...Read now
Unlock full access