October 2018
Intermediate to advanced
252 pages
6h 49m
English
We will be using a neural network to build the AI agent that plays Cartpole. The neural network will have input with four parameters, three hidden layers, and output with two possible outputs: 0 or 1:
model = Sequential()model.add(Dense(24, input_dim=self.state_size, activation='relu'))model.add(Dense(24, activation='relu'))model.add(Dense(self.action_size, activation='linear'))model.compile(loss='mse', optimizer=Adam(lr=self.learning_rate))
We are using linear activation, mean square error (MSE) loss, and the Adam optimizer as the characteristics of the neural network.