|
17 | 17 | "editable": true |
18 | 18 | }, |
19 | 19 | "source": [ |
20 | | - "## Getting a feel for the data\n", |
21 | | - "\n", |
22 | 20 | "Let's start by importing some packages we need." |
23 | 21 | ] |
24 | 22 | }, |
|
52 | 50 | "editable": true |
53 | 51 | }, |
54 | 52 | "source": [ |
55 | | - "MNIST is a dataset that contains 70,000 labelled images of handwritten digits. We're going to train a linear classifier on a part of this data set, and test it against another portion of the data set to see how well we did.\n", |
| 53 | + "## Getting a feel for the data\n", |
| 54 | + "\n", |
| 55 | + "MNIST is a dataset that contains 70,000 labelled images of handwritten digits that look like the following.\n", |
| 56 | + "\n", |
| 57 | + "\n", |
| 58 | + "\n", |
| 59 | + "We're going to train a linear classifier on a part of this data set, and test it against another portion of the data set to see how well we did.\n", |
56 | 60 | "\n", |
57 | 61 | "The TensorFlow tutorial comes with a handy loader for this dataset." |
58 | 62 | ] |
|
236 | 240 | "editable": true |
237 | 241 | }, |
238 | 242 | "source": [ |
239 | | - "We define a nonlinear model for the score function (a vanilla neural network) after introducing two sets of parameters, **W1**, **b1** and **W2**, **b2**." |
| 243 | + "We define a nonlinear model for the score function (a vanilla neural network) after introducing two sets of parameters, **W1**, **b1** and **W2**, **b2**.\n", |
| 244 | + "\n", |
| 245 | + "" |
240 | 246 | ] |
241 | 247 | }, |
242 | 248 | { |
|
275 | 281 | "\n", |
276 | 282 | "````\n", |
277 | 283 | "\n", |
278 | | - "We define our loss function to measure how poorly this model performs on images with known labels. We think of the scores we have as unnormalized log probabilities of the classes, and take the cross entropy loss of the softmax of the class scores determined by our score function." |
| 284 | + "We define our loss function to measure how poorly this model performs on images with known labels. We use the a specific form called the [cross entropy loss](https://jamesmccaffrey.wordpress.com/2013/11/05/why-you-should-use-cross-entropy-error-instead-of-classification-error-or-mean-squared-error-for-neural-network-classifier-training/)." |
279 | 285 | ] |
280 | 286 | }, |
281 | 287 | { |
|
298 | 304 | "editable": true |
299 | 305 | }, |
300 | 306 | "source": [ |
301 | | - "Using the magic of blackbox optimisation algorithms provided by TensorFlow, we can define a single step of the stochastic gradient descent optimiser to improve our parameters for our score function and reduce the loss." |
| 307 | + "Using the magic of blackbox optimisation algorithms provided by TensorFlow, we can define a single step of the stochastic gradient descent optimiser (to improve our parameters for our score function and reduce the loss) in one line of code." |
302 | 308 | ] |
303 | 309 | }, |
304 | 310 | { |
|
425 | 431 | "1. Play around with the length of the hidden layer and see how the accuracy changes.\n", |
426 | 432 | "\n", |
427 | 433 | "2. Try extending the model to two hidden layers and see how much the accuracy increases:\n", |
| 434 | + "\n", |
| 435 | + " \n", |
428 | 436 | " \n", |
429 | 437 | " ````\n", |
430 | 438 | " W1 = tf.Variable(tf.truncated_normal(shape=[784, 400], stddev=0.1))\n", |
|
0 commit comments