18
18
},
19
19
{
20
20
"cell_type" : " code" ,
21
- "execution_count" : 2 ,
21
+ "execution_count" : 1 ,
22
22
"metadata" : {
23
23
"collapsed" : false
24
24
},
27
27
"name" : " stdout" ,
28
28
"output_type" : " stream" ,
29
29
"text" : [
30
- " Extracting /tmp/data /train-images-idx3-ubyte.gz\n " ,
31
- " Extracting /tmp/data /train-labels-idx1-ubyte.gz\n " ,
32
- " Extracting /tmp/data /t10k-images-idx3-ubyte.gz\n " ,
33
- " Extracting /tmp/data /t10k-labels-idx1-ubyte.gz\n "
30
+ " Extracting MNIST_data /train-images-idx3-ubyte.gz\n " ,
31
+ " Extracting MNIST_data /train-labels-idx1-ubyte.gz\n " ,
32
+ " Extracting MNIST_data /t10k-images-idx3-ubyte.gz\n " ,
33
+ " Extracting MNIST_data /t10k-labels-idx1-ubyte.gz\n "
34
34
]
35
35
}
36
36
],
40
40
" \n " ,
41
41
" # Import MINST data\n " ,
42
42
" from tensorflow.examples.tutorials.mnist import input_data\n " ,
43
- " mnist = input_data.read_data_sets(\" /tmp/data /\" , one_hot=True)"
43
+ " mnist = input_data.read_data_sets(\" MNIST_data /\" , one_hot=True)"
44
44
]
45
45
},
46
46
{
47
47
"cell_type" : " code" ,
48
- "execution_count" : 3 ,
48
+ "execution_count" : 2 ,
49
49
"metadata" : {
50
- "collapsed" : true
50
+ "collapsed" : false
51
51
},
52
52
"outputs" : [],
53
53
"source" : [
61
61
" \n " ,
62
62
" # Nearest Neighbor calculation using L1 Distance\n " ,
63
63
" # Calculate L1 Distance\n " ,
64
- " distance = tf.reduce_sum(tf.abs(tf.add(xtr, tf.neg (xte))), reduction_indices=1)\n " ,
64
+ " distance = tf.reduce_sum(tf.abs(tf.add(xtr, tf.negative (xte))), reduction_indices=1)\n " ,
65
65
" # Prediction: Get min distance index (Nearest neighbor)\n " ,
66
66
" pred = tf.arg_min(distance, 0)\n " ,
67
67
" \n " ,
68
68
" accuracy = 0.\n " ,
69
69
" \n " ,
70
70
" # Initializing the variables\n " ,
71
- " init = tf.initialize_all_variables ()"
71
+ " init = tf.global_variables_initializer ()"
72
72
]
73
73
},
74
74
{
75
75
"cell_type" : " code" ,
76
- "execution_count" : 4 ,
76
+ "execution_count" : 3 ,
77
77
"metadata" : {
78
78
"collapsed" : false
79
79
},
305
305
" print \" Done!\"\n " ,
306
306
" print \" Accuracy:\" , accuracy"
307
307
]
308
+ },
309
+ {
310
+ "cell_type" : " code" ,
311
+ "execution_count" : null ,
312
+ "metadata" : {
313
+ "collapsed" : true
314
+ },
315
+ "outputs" : [],
316
+ "source" : []
308
317
}
309
318
],
310
319
"metadata" : {
316
325
"language_info" : {
317
326
"codemirror_mode" : {
318
327
"name" : " ipython" ,
319
- "version" : 2.0
328
+ "version" : 2
320
329
},
321
330
"file_extension" : " .py" ,
322
331
"mimetype" : " text/x-python" ,
323
332
"name" : " python" ,
324
333
"nbconvert_exporter" : " python" ,
325
334
"pygments_lexer" : " ipython2" ,
326
- "version" : " 2.7.11 "
335
+ "version" : " 2.7.13 "
327
336
}
328
337
},
329
338
"nbformat" : 4 ,
330
339
"nbformat_minor" : 0
331
- }
340
+ }
0 commit comments