Network construction and training

As I stated, we will create a DQN network using MultiLayerNetwork and the MultiLayerConfiguration configuration of DL4J, which will serve as our Q-function. Therefore, the first step is to create a MultiLayerNetwork by defining MultiLayerConfiguration. Since the state has 64 elements—4 x 4 x 4our network has to have an input layer of 64 units, two hidden layers of 164 and 150 units each, and an output layer of 4, for four possible actions (up, down, left, and right). This is outlined here:

The structure of the DQN network, showing an input layer, two hidden layers, and an output layer

Nevertheless, we will ...

Get Java Deep Learning Projects 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.