It’s March and no new wars! Hooray!

7:00 – 8:00 Research

- Added an excerpt (the last half or so) from Home to Roost to the paper. Disturbingly appropriate.
- Continuing conference/journal spreadsheet. Here’s the sorted list:

- Next step is to find submission formats. The obvious targets are Phys Rev E and IEEE TAC. I’m tempted by the JofPP, since that was where the original group polarization paper was published. And I need to understand what a Nature letter is.

8:30 – 4:30 BRC

- More TensorFlow
- MNIST tutorial – clear, but a LOT of stuff
- Neural Networks and Deep Learning is an online book referenced in the TF documentation (at least the softmax chapter)
- A
*one-hot*vector is a vector which is 0 in most dimensions, and*1 in a single dimension*. In this case, the nth digit will be represented as a vector which is 1 in the nth dimension. For example, 3 would be [0,0,0,1,0,0,0,0,0,0]. Consequently, mnist.train.labels is a [55000, 10] array of floats. - If you want to assign probabilities to an object being one of several different things,
*softmax*is the thing to do, because*softmax gives us a list of values between 0 and 1 that add up to 1*. Even later on, when we train more sophisticated models, the final step will be a layer of softmax. -
x = tf.placeholder(tf.float32, [None, 784])

We represent this as a 2-D tensor of floating-point numbers, with a shape

`[None, 784]`

. (Here`None`

means that a dimension can be of any length.) - A good explanation of cross-entropy, apparently.
- tf.reduce_mean
- Success!!! Here’s the code:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) x = tf.placeholder(tf.float32, [None, 784]) W = tf.Variable(tf.zeros([784, 10])) b = tf.Variable(tf.zeros([10])) y = tf.nn.softmax(tf.matmul(x, W) + b) y_ = tf.placeholder(tf.float32, [None, 10]) #note that y_ means 'y prme' cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1])) train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy) sess = tf.InteractiveSession() tf.global_variables_initializer().run() for _ in range(1000): batch_xs, batch_ys = mnist.train.next_batch(100) sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys}) correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1)) accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) print(sess.run(accuracy, feed_dict={x: mnist.test.images, y_: mnist.test.labels}))

- And here are the results:
C:\Users\philip.feldman\AppData\Local\Programs\Python\Python35\python.exe C:/Development/Sandboxes/TensorflowPlayground/HelloPackage/MNIST_tutorial.py Extracting MNIST_data/train-images-idx3-ubyte.gz Extracting MNIST_data/train-labels-idx1-ubyte.gz Extracting MNIST_data/t10k-images-idx3-ubyte.gz Extracting MNIST_data/t10k-labels-idx1-ubyte.gz 0.9192

- Working on the advanced tutorial. Fixed fully_connected_feed.py to work with local data.
- And then my brain died

Advertisements