Skip to content

Commit 12a70fe

Browse files
committed
update docs & fix
1 parent 6f33ebe commit 12a70fe

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

nearest_neighbor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
Xtr, Ytr = mnist.train.next_batch(5000) #5000 for training (nn candidates)
1313
Xte, Yte = mnist.test.next_batch(200) #200 for testing
1414

15+
#Reshape images to 1D
1516
Xtr = np.reshape(Xtr, newshape=(-1, 28*28))
1617
Xte = np.reshape(Xte, newshape=(-1, 28*28))
1718

1819
xtr = tf.placeholder("float", [None, 784])
1920
xte = tf.placeholder("float", [784])
2021

21-
nn = tf.Variable(tf.zeros([10]))
22-
2322
#Calculation of L1 Distance
2423
distance = tf.reduce_sum(tf.abs(tf.add(xtr, tf.neg(xte))), reduction_indices=1)
2524
#Predict: Get min distance index (Nearest neighbor)

0 commit comments

Comments
 (0)