July 2018
Beginner to intermediate
406 pages
9h 55m
English
Let's think of the type of architecture we need here. We have the state of the game as the input, and we want one of four values as the output. The game is simple enough that there is an optimal strategy, a unique path to get from the start to the goal. This means that the network can be very simple, with just one layer and a linear output:
inputs = tf.placeholder(shape=[None, 16], dtype=tf.float32, name="input")Qout = tf.layers.dense( inputs=inputs, units=4, use_bias=False, name="dense", kernel_initializer= tf.random_uniform_initializer(minval=0, maxval=.0125))predict = tf.argmax(Qout, 1)# Our optimizer will try to optimize nextQ = tf.placeholder(shape=[None, 4], dtype=tf.float32, name="target")loss = tf.reduce_sum(tf.square(nextQ ...
Read now
Unlock full access